D5792: uncommit: added interactive mode(issue6062)

2019-01-31 Thread taapas1128 (Taapas Agrawal)
taapas1128 updated this revision to Diff 13669.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5792?vs=13668=13669

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

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

CHANGE DETAILS

diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t
--- a/tests/test-uncommit.t
+++ b/tests/test-uncommit.t
@@ -1,6 +1,8 @@
 Test uncommit - set up the config
 
   $ cat >> $HGRCPATH < [ui]
+  > interactive = true
   > [experimental]
   > evolution.createmarkers=True
   > evolution.allowunstable=True
@@ -34,6 +36,7 @@
   
   options ([+] can be repeated):
   
+   -i --interactive use interactive mode
   --keepallow an empty commit after uncommiting
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
@@ -398,3 +401,17 @@
   |/
   o  0:ea4e33293d4d274a2ba73150733c2612231f398c a 1
   
+Test for interactive mode
+  $ hg init repo3
+  $ touch x
+  $ hg add x
+  $ hg commit -m "added x"
+  $ hg uncommit -i< y
+  > EOF
+  diff --git a/x b/x
+  new file mode 100644
+  examine changes to 'x'? [Ynesfdaq?] y
+  
+  abort: empty commit message
+  [255]
diff --git a/hgext/uncommit.py b/hgext/uncommit.py
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -136,7 +136,8 @@
 ds.copy(src, dst)
 
 @command('uncommit',
-[('', 'keep', False, _('allow an empty commit after uncommiting')),
+[('i', 'interactive', None, _('use interactive mode')),
+('', 'keep', False, _('allow an empty commit after uncommiting')),
 ] + commands.walkopts,
 _('[OPTION]... [FILE]...'),
 helpcategory=command.CATEGORY_CHANGE_MANAGEMENT)
@@ -186,6 +187,11 @@
 s = old.p1().status(old, match=match)
 _fixdirstate(repo, old, repo[newid], s)
 
+if opts.get(r'interactive'):
+opts.pop(r'interactive')
+ret = cmdutil.dorecord(ui, repo, commands.commit, None, False,
+   cmdutil.recordfilter, *pats,
+   **opts)
 def predecessormarkers(ctx):
 """yields the obsolete markers marking the given changeset as a 
successor"""
 for data in ctx.repo().obsstore.predecessors.get(ctx.node(), ()):



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


D5792: uncommit: added interactive mode(issue6062)

2019-01-31 Thread taapas1128 (Taapas Agrawal)
taapas1128 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS

diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t
--- a/tests/test-uncommit.t
+++ b/tests/test-uncommit.t
@@ -1,6 +1,8 @@
 Test uncommit - set up the config
 
   $ cat >> $HGRCPATH < [ui]
+  > interactive = true
   > [experimental]
   > evolution.createmarkers=True
   > evolution.allowunstable=True
@@ -34,6 +36,7 @@
   
   options ([+] can be repeated):
   
+   -i --interactive use interactive mode
   --keepallow an empty commit after uncommiting
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
@@ -398,3 +401,17 @@
   |/
   o  0:ea4e33293d4d274a2ba73150733c2612231f398c a 1
   
+Test for interactive mode
+  $ hg init repo3
+  $ touch x
+  $ hg add x
+  $ hg commit -m "added x"
+  $ hg uncommit -i< y
+  > EOF
+  diff --git a/x b/x
+  new file mode 100644
+  examine changes to 'x'? [Ynesfdaq?] y
+  
+  abort: empty commit message
+  [255]
diff --git a/hgext/uncommit.py b/hgext/uncommit.py
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -136,7 +136,8 @@
 ds.copy(src, dst)
 
 @command('uncommit',
-[('', 'keep', False, _('allow an empty commit after uncommiting')),
+[('i', 'interactive', None, _('use interactive mode')),
+('', 'keep', False, _('allow an empty commit after uncommiting')),
 ] + commands.walkopts,
 _('[OPTION]... [FILE]...'),
 helpcategory=command.CATEGORY_CHANGE_MANAGEMENT)
@@ -151,6 +152,7 @@
 If no files are specified, the commit will be pruned, unless --keep is
 given.
 """
+
 opts = pycompat.byteskwargs(opts)
 
 with repo.wlock(), repo.lock():
@@ -186,6 +188,11 @@
 s = old.p1().status(old, match=match)
 _fixdirstate(repo, old, repo[newid], s)
 
+if opts.get(r'interactive'):
+opts.pop(r'interactive')
+ret = cmdutil.dorecord(ui, repo, commands.commit, None, False,
+   cmdutil.recordfilter, *pats,
+   **opts)
 def predecessormarkers(ctx):
 """yields the obsolete markers marking the given changeset as a 
successor"""
 for data in ctx.repo().obsstore.predecessors.get(ctx.node(), ()):



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


Re: [PATCH V4] extdiff: add --per-file and --confirm options

2019-01-31 Thread Ludovic Chabant

> Unused in this version. Removed.
> 
> Looks like unrelated change. Also removed.

Indeed, sorry, I didn't correctly split my commit in 2. Thanks for the cleanup!

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


[PATCH 2 of 2] tests: quote $PYTHON for py3 support on Windows

2019-01-31 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1548990069 18000
#  Thu Jan 31 22:01:09 2019 -0500
# Node ID 44c5506a25728b51c52cdb7bab20f0adf16eca02
# Parent  d3dc4abc547aca55e1de6b89ff59e86e635d5ec8
tests: quote $PYTHON for py3 support on Windows

diff --git a/tests/test-convert-hg-svn.t b/tests/test-convert-hg-svn.t
--- a/tests/test-convert-hg-svn.t
+++ b/tests/test-convert-hg-svn.t
@@ -11,7 +11,7 @@
   > EOF
 
   $ SVNREPOPATH=`pwd`/svn-repo
-  $ SVNREPOURL="`$PYTHON $TESTDIR/svnurlof.py \"$SVNREPOPATH\"`"
+  $ SVNREPOURL="`"$PYTHON" $TESTDIR/svnurlof.py \"$SVNREPOPATH\"`"
 
   $ svnadmin create "$SVNREPOPATH"
   $ cat > "$SVNREPOPATH"/hooks/pre-revprop-change < egrep -v 'Committing|Transmitting|Updating|(^$)' || true
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2] py3: byteify the --retest path of run-tests.py

2019-01-31 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1548989678 18000
#  Thu Jan 31 21:54:38 2019 -0500
# Node ID d3dc4abc547aca55e1de6b89ff59e86e635d5ec8
# Parent  fe2c826533a7285a38d536b532e0068ca4fb64e1
py3: byteify the --retest path of run-tests.py

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2772,8 +2772,8 @@ class TestRunner(object):
 """
 if not args:
 if self.options.changed:
-proc = Popen4('hg st --rev "%s" -man0 .' %
-  self.options.changed, None, 0)
+proc = Popen4(b'hg st --rev "%s" -man0 .' %
+  _bytespath(self.options.changed), None, 0)
 stdout, stderr = proc.communicate()
 args = stdout.strip(b'\0').split(b'\0')
 else:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5791: debugcommands: add a debugpathcopies command

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

REVISION SUMMARY
  I've been working on storing copy metadata in the changelog instead of
  the filelog and this has been useful for debugging.
  
  Do we usually add tests for these?

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/debugcommands.py
  tests/test-completion.t
  tests/test-help.t

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1014,6 +1014,8 @@
debugoptEXP   (no help text available)
debugpathcomplete
  complete part or all of a tracked path
+   debugpathcopies
+ show copies between two revisions
debugpeer establish a connection to a peer repository
debugpickmergetool
  examine which merge tool is chosen for specified file
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -104,6 +104,7 @@
   debugnamecomplete
   debugobsolete
   debugpathcomplete
+  debugpathcopies
   debugpeer
   debugpickmergetool
   debugpushkey
@@ -280,6 +281,7 @@
   debugnamecomplete: 
   debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, 
user, template
   debugpathcomplete: full, normal, added, removed
+  debugpathcopies: 
   debugpeer: 
   debugpickmergetool: rev, changedelete, include, exclude, tool
   debugpushkey: 
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -38,6 +38,7 @@
 cmdutil,
 color,
 context,
+copies,
 dagparser,
 encoding,
 error,
@@ -1804,6 +1805,18 @@
 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
 ui.write('\n')
 
+@command('debugpathcopies',
+ cmdutil.walkopts,
+ 'hg debugcopies REV1 REV2 [FILE]',
+ inferrepo=True)
+def debugpathcopies(ui, repo, rev1, rev2, *pats, **opts):
+"""show copies between two revisions"""
+ctx1 = scmutil.revsingle(repo, rev1)
+ctx2 = scmutil.revsingle(repo, rev2)
+m = scmutil.match(ctx1, pats, opts)
+for dst, src in copies.pathcopies(ctx1, ctx2, m).items():
+ui.write('%s -> %s\n' % (src, dst))
+
 @command('debugpeer', [], _('PATH'), norepo=True)
 def debugpeer(ui, path):
 """establish a connection to a peer repository"""



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


D5790: diff: drop duplicate filter of copies by destination

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

REVISION SUMMARY
  I'm pretty sure we don't need to filter copies by destination, at
  least since the previous patch.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/patch.py

CHANGE DETAILS

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -2343,10 +2343,10 @@
 copy = copies.pathcopies(ctx1, ctx2, match=match)
 
 if relroot:
-# filter out copies where either side isn't inside the relative root
-copy = dict(((dst, src) for (dst, src) in copy.iteritems()
- if dst.startswith(relroot)
- and src.startswith(relroot)))
+# filter out copies where source side isn't inside the relative root
+# (copies.pathcopies() already filtered out the destination)
+copy = {dst: src for dst, src in copy.iteritems()
+if src.startswith(relroot)}
 
 modifiedset = set(modified)
 addedset = set(added)



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


D5789: diff: use match.intersectmatchers()

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

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/patch.py

CHANGE DETAILS

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -32,6 +32,7 @@
 encoding,
 error,
 mail,
+match as matchmod,
 mdiff,
 pathutil,
 pycompat,
@@ -2319,12 +2320,9 @@
 ctx1 = repo[node1]
 ctx2 = repo[node2]
 
-relfiltered = False
-if relroot != '' and match.always():
-# as a special case, create a new matcher with just the relroot
-pats = [relroot]
-match = scmutil.match(ctx2, pats, default='path')
-relfiltered = True
+if relroot:
+relrootmatch = scmutil.match(ctx2, pats=[relroot], default='path')
+match = matchmod.intersectmatchers(match, relrootmatch)
 
 if not changes:
 changes = ctx1.status(ctx2, match=match)
@@ -2344,16 +2342,7 @@
 if opts.git or opts.upgrade:
 copy = copies.pathcopies(ctx1, ctx2, match=match)
 
-if relroot is not None:
-if not relfiltered:
-# XXX this would ideally be done in the matcher, but that is
-# generally meant to 'or' patterns, not 'and' them. In this case we
-# need to 'and' all the patterns from the matcher with relroot.
-def filterrel(l):
-return [f for f in l if f.startswith(relroot)]
-modified = filterrel(modified)
-added = filterrel(added)
-removed = filterrel(removed)
+if relroot:
 # filter out copies where either side isn't inside the relative root
 copy = dict(((dst, src) for (dst, src) in copy.iteritems()
  if dst.startswith(relroot)



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


D5777: grep: respect ui.relative-paths

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5777?vs=13635=13664

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-grep.t

CHANGE DETAILS

diff --git a/tests/test-grep.t b/tests/test-grep.t
--- a/tests/test-grep.t
+++ b/tests/test-grep.t
@@ -32,6 +32,20 @@
   port:4:vaportight
   port:4:import/export
 
+simple from subdirectory
+
+  $ mkdir dir
+  $ cd dir
+  $ hg grep -r tip:0 port
+  port:4:export
+  port:4:vaportight
+  port:4:import/export
+  $ hg grep -r tip:0 port --config ui.relative-paths=yes
+  ../port:4:export
+  ../port:4:vaportight
+  ../port:4:import/export
+  $ cd ..
+
 simple with color
 
   $ hg --config extensions.color= grep --config color.mode=ansi \
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2848,6 +2848,7 @@
 for i in pycompat.xrange(blo, bhi):
 yield ('+', b[i])
 
+uipathfn = scmutil.getuipathfn(repo)
 def display(fm, fn, ctx, pstates, states):
 rev = scmutil.intrev(ctx)
 if fm.isplain():
@@ -2875,8 +2876,8 @@
 for change, l in iter:
 fm.startitem()
 fm.context(ctx=ctx)
-fm.data(node=fm.hexfunc(scmutil.binnode(ctx)))
-fm.write('path', '%s', fn, label='grep.filename')
+fm.data(node=fm.hexfunc(scmutil.binnode(ctx)), path=fn)
+fm.plain('%s' % uipathfn(fn), label='grep.filename')
 
 cols = [
 ('rev', '%d', rev, not plaingrep),



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


D5748: resolve: respect ui.relative-paths

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5748?vs=13633=13662

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -67,6 +67,9 @@
   $ hg resolve -l
   R file1
   U file2
+  $ hg resolve -l --config ui.relative-paths=yes
+  R ../file1
+  U ../file2
   $ hg resolve --re-merge filez file2
   arguments do not match paths that need resolving
   (try: hg resolve --re-merge path:filez path:file2)
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4840,6 +4840,8 @@
  b'$$  $$ ')):
 raise error.Abort(_('user quit'))
 
+uipathfn = scmutil.getuipathfn(repo)
+
 if show:
 ui.pager('resolve')
 fm = ui.formatter('resolve', opts)
@@ -4867,7 +4869,8 @@
 fm.startitem()
 fm.context(ctx=wctx)
 fm.condwrite(not nostatus, 'mergestatus', '%s ', key, label=label)
-fm.write('path', '%s\n', f, label=label)
+fm.data(path=f)
+fm.plain('%s\n' % uipathfn(f), label=label)
 fm.end()
 return 0
 



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


D5776: grep: move writing of path outside of column loop

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5776?vs=13634=13663

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2867,18 +2867,18 @@
 except error.WdirUnsupported:
 return ctx[fn].isbinary()
 
-fieldnamemap = {'filename': 'path', 'linenumber': 'lineno'}
+fieldnamemap = {'linenumber': 'lineno'}
 if diff:
 iter = difflinestates(pstates, states)
 else:
 iter = [('', l) for l in states]
 for change, l in iter:
 fm.startitem()
 fm.context(ctx=ctx)
 fm.data(node=fm.hexfunc(scmutil.binnode(ctx)))
+fm.write('path', '%s', fn, label='grep.filename')
 
 cols = [
-('filename', '%s', fn, True),
 ('rev', '%d', rev, not plaingrep),
 ('linenumber', '%d', l.linenum, opts.get('line_number')),
 ]
@@ -2889,13 +2889,11 @@
 ('date', '%s', fm.formatdate(ctx.date(), datefmt),
  opts.get('date')),
 ])
-lastcol = next(
-name for name, fmt, data, cond in reversed(cols) if cond)
 for name, fmt, data, cond in cols:
+if cond:
+fm.plain(sep, label='grep.sep')
 field = fieldnamemap.get(name, name)
 fm.condwrite(cond, field, fmt, data, label='grep.%s' % name)
-if cond and name != lastcol:
-fm.plain(sep, label='grep.sep')
 if not opts.get('files_with_matches'):
 fm.plain(sep, label='grep.sep')
 if not opts.get('text') and binary():



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


D5744: commit: ignore diff whitespace settings when doing `commit -i` (issue5839)

2019-01-31 Thread spectral (Kyle Lippincott)
spectral added a comment.


  I've sent https://phab.mercurial-scm.org/D5787 and 
https://phab.mercurial-scm.org/D5788, implementing support for 
`whitespace='noconfig'` to parse them from the commandline args, but ignore the 
settings from the user's config.  I did not add this to `revert --interactive`, 
since that does not currently have any way of getting args specified on the 
commandline that affect the whitespace settings (so I'm keeping `revert 
--interactive` *ignoring* the user's diff settings).

REPOSITORY
  rHG Mercurial

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

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


D5788: commit: make `commit -i` respect whitespace CLI args, ignore config

2019-01-31 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The `record` extension supports specifying various flags on the commandline to
  change the way that whitespace is handled when partially committing the 
change.
  https://phab.mercurial-scm.org/D5744 broke this functionality, this commit 
restores it while still resolving
  issue6042 and issue5839.

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS

diff --git a/tests/test-record.t b/tests/test-record.t
--- a/tests/test-record.t
+++ b/tests/test-record.t
@@ -88,5 +88,46 @@
   date:Thu Jan 01 00:00:00 1970 +
   
   
+  $ cd $TESTTMP
 
+Test the whitespace diffopts
 
+  $ hg init whitespace
+  $ cd whitespace
+  $ cat > foo < line1
+  > line2
+  > EOF
+  $ hg ci -qAm 'initial'
+  $ cat > foo < line1
+  > 
+  > line2
+  > line3
+  > EOF
+  $ hg record -qAm 'with ignore-blank-lines' --ignore-blank-lines < f
+  > EOF
+  diff --git a/foo b/foo
+  1 hunks, 1 lines changed
+  examine changes to 'foo'? [Ynesfdaq?] f
+  
+(blank line should not have been recorded)
+  $ hg diff -c .
+  diff -r 2bebe08ba9bd -r cc97ffa5d61f foo
+  --- a/fooThu Jan 01 00:00:00 1970 +
+  +++ b/fooThu Jan 01 00:00:00 1970 +
+  @@ -1,2 +1,3 @@
+   line1
+   line2
+  +line3
+  $ hg diff
+  diff -r cc97ffa5d61f foo
+  --- a/fooThu Jan 01 00:00:00 1970 +
+  +++ b/fooThu Jan 01 00:00:00 1970 +
+  @@ -1,3 +1,4 @@
+   line1
+  +
+   line2
+   line3
+  $ cd $TESTTMP
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -282,7 +282,7 @@
 status = repo.status(match=match)
 if not force:
 repo.checkcommitpatterns(wctx, vdirs, match, status, fail)
-diffopts = patch.difffeatureopts(ui, opts=opts)
+diffopts = patch.difffeatureopts(ui, opts=opts, whitespace='noconfig')
 diffopts.nodates = True
 diffopts.git = True
 diffopts.showfunc = True



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


D5787: diff: support ignoring config settings when parsing optional diffopts

2019-01-31 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Previously, there was no supported way of respecting diff options set on the
  command line without picking up potentially breaking settings from the config.
  
  With this change, we can call difffeatureopts(..., whitespace='noconfig') to
  ignore the user's config for the `whitespace` category of "optional features",
  but respect options set on the commandline (even whitespace options) and 
respect
  the user's config for "non-optional features" (nodates, showfunc, context).
  
  It's not clear if that last aspect is useful, but it seemed plausible that
  setting `diff.nodates` or `diff.showfunc` should be respected even when 
running
  `commit --interactive`, while it seems unlikely that the user intended to have
  diff.ignoreblanklines apply when calling `commit --interactive`.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/diffutil.py

CHANGE DETAILS

diff --git a/mercurial/diffutil.py b/mercurial/diffutil.py
--- a/mercurial/diffutil.py
+++ b/mercurial/diffutil.py
@@ -30,8 +30,15 @@
 - whitespace: whitespace options like ignoreblanklines and ignorews
 - formatchanging: options that will likely break or cause correctness 
issues
   with most diff parsers
+
+For the category settings (whitespace, git, formatchanging), the valid
+values are True, False, or the string 'noconfig'. If the string 'noconfig'
+is used, then only values in `opts` are considered, otherwise this returns
+False (which is the default value for all options besides 'unified', which
+does not set 'category').
 '''
-def get(key, name=None, getter=ui.configbool, forceplain=None):
+def get(key, name=None, getter=ui.configbool, forceplain=None,
+category=None):
 if opts:
 v = opts.get(key)
 # diffopts flags are either None-default (which is passed
@@ -45,6 +52,8 @@
 return v
 if forceplain is not None and ui.plain():
 return forceplain
+if category == 'noconfig':
+return False
 return getter(section, name or key, untrusted=untrusted)
 
 # core options, expected to be understood by every diff parser
@@ -56,7 +65,7 @@
 buildopts['xdiff'] = ui.configbool('experimental', 'xdiff')
 
 if git:
-buildopts['git'] = get('git')
+buildopts['git'] = get('git', category=git)
 
 # since this is in the experimental section, we need to call
 # ui.configbool directory
@@ -88,18 +97,25 @@
 buildopts['index'] = hlen
 
 if whitespace:
-buildopts['ignorews'] = get('ignore_all_space', 'ignorews')
-buildopts['ignorewsamount'] = get('ignore_space_change',
+getws = lambda *args, **kwargs: get(*args, category=whitespace,
+**kwargs)
+
+buildopts['ignorews'] = getws('ignore_all_space', 'ignorews')
+buildopts['ignorewsamount'] = getws('ignore_space_change',
   'ignorewsamount')
-buildopts['ignoreblanklines'] = get('ignore_blank_lines',
+buildopts['ignoreblanklines'] = getws('ignore_blank_lines',
 'ignoreblanklines')
-buildopts['ignorewseol'] = get('ignore_space_at_eol', 'ignorewseol')
+buildopts['ignorewseol'] = getws('ignore_space_at_eol', 'ignorewseol')
 if formatchanging:
+getfc = lambda *args, **kwargs: get(*args, category=formatchanging,
+**kwargs)
+
 buildopts['text'] = opts and opts.get('text')
 binary = None if opts is None else opts.get('binary')
 buildopts['nobinary'] = (not binary if binary is not None
- else get('nobinary', forceplain=False))
-buildopts['noprefix'] = get('noprefix', forceplain=False)
-buildopts['worddiff'] = get('word_diff', 'word-diff', forceplain=False)
+ else getfc('nobinary', forceplain=False))
+buildopts['noprefix'] = getfc('noprefix', forceplain=False)
+buildopts['worddiff'] = getfc('word_diff', 'word-diff',
+  forceplain=False)
 
 return mdiff.diffopts(**pycompat.strkwargs(buildopts))



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


Re: D5744: commit: ignore diff whitespace settings when doing `commit -i` (issue5839)

2019-01-31 Thread Yuya Nishihara
>   I wasn't able to come up with a reason to support these but only when 
> committing interactively (as I said in the commit description), but I guess 
> there's justification in 
> https://www.mercurial-scm.org/pipermail/mercurial-devel/2011-June/032316.html.
>   
>   So I think I can understand why this is desired for this command. Maybe a 
> better option is to change the difffeatureopts() call to replace the section 
> that it looks in? i.e. change:
>   
> diffopts = patch.difffeatureopts(repo.ui, whitespace=True)
>   
>   to:
>   
> diffopts = patch.difffeatureopts(repo.ui, section='commands-interactive', 
> whitespace=True)
>   
>   This way we aren't looking at the `[diff]` section, so the options 
> specified on the commandline end up working, and if someone really does want 
> this as a default, they can get that behavior.
>   
>   I'm not at all attached to that section name, i.e. I could see this being 
> something like the following, to make it look at 
> commands.commit.interactive.ignorews (and others):
>   
> diffopts = patch.difffeatureopts(repo.ui, section='commands', 
> configprefix='commit.interactive.', whitespace=True)
>   
>   I think I like that option, I'll send a patch for it.

I can't think of a nicer section name, but I like the idea in general. We'll
also need to apply that to `hg revert --interactive`.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5744: commit: ignore diff whitespace settings when doing `commit -i` (issue5839)

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


  >   I wasn't able to come up with a reason to support these but only when 
committing interactively (as I said in the commit description), but I guess 
there's justification in 
https://www.mercurial-scm.org/pipermail/mercurial-devel/2011-June/032316.html.
  >   
  >   So I think I can understand why this is desired for this command. Maybe a 
better option is to change the difffeatureopts() call to replace the section 
that it looks in? i.e. change:
  >   
  > diffopts = patch.difffeatureopts(repo.ui, whitespace=True)
  >   
  >   to:
  >   
  > diffopts = patch.difffeatureopts(repo.ui, 
section='commands-interactive', whitespace=True)
  >   
  >   This way we aren't looking at the `[diff]` section, so the options 
specified on the commandline end up working, and if someone really does want 
this as a default, they can get that behavior.
  >   
  >   I'm not at all attached to that section name, i.e. I could see this being 
something like the following, to make it look at 
commands.commit.interactive.ignorews (and others):
  >   
  > diffopts = patch.difffeatureopts(repo.ui, section='commands', 
configprefix='commit.interactive.', whitespace=True)
  >   
  >   I think I like that option, I'll send a patch for it.
  
  I can't think of a nicer section name, but I like the idea in general. We'll
  also need to apply that to `hg revert --interactive`.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH 1 of 3] revset: extract a helper to parse integer range

2019-01-31 Thread Yuya Nishihara
On Thu, 31 Jan 2019 23:21:48 +0800, Anton Shestakov wrote:
> On Thu, 31 Jan 2019 23:19:18 +0900
> Yuya Nishihara  wrote:
> 
> > # HG changeset patch
> > # User Yuya Nishihara 
> > # Date 1548562733 -32400
> > #  Sun Jan 27 13:18:53 2019 +0900
> > # Node ID 5e5dda247ee2ba8407bc4932118a944c1959b1f9
> > # Parent  1aa52287973e180eaf23c32dd454d38537facb8e
> > revset: extract a helper to parse integer range
> > 
> > It's getting common. As a first step, this patch adds getintrange() and
> > makes followlines() use it.
> > 
> > diff --git a/mercurial/revset.py b/mercurial/revset.py
> > --- a/mercurial/revset.py
> > +++ b/mercurial/revset.py
> > @@ -44,6 +44,7 @@ getinteger = revsetlang.getinteger
> >  getboolean = revsetlang.getboolean
> >  getlist = revsetlang.getlist
> >  getrange = revsetlang.getrange
> > +getintrange = revsetlang.getintrange
> >  getargs = revsetlang.getargs
> >  getargsdict = revsetlang.getargsdict
> >  
> > @@ -1067,11 +1068,10 @@ def followlines(repo, subset, x):
> >  # i18n: "followlines" is a keyword
> >  msg = _("followlines expects exactly one file")
> >  fname = scmutil.parsefollowlinespattern(repo, rev, pat, msg)
> > -# i18n: "followlines" is a keyword
> > -lr = getrange(args['lines'][0], _("followlines expects a line range"))
> > -fromline, toline = [getinteger(a, _("line range bounds must be 
> > integers"))
> > -for a in lr]
> > -fromline, toline = util.processlinerange(fromline, toline)
> > +fromline, toline = util.processlinerange(
> > +*getintrange(args['lines'][0],
> > + # i18n: "followlines" is a keyword
> > + _("followlines expects an integer line range")))
> 
> Maybe it's me, but I couldn't parse "integer line range" without taking
> a moment to think. I think the two old messages are easier to
> understand, because one is a broad description of what's expected and
> the other is an error message just in case. I mean, it's already logical
> that a range of lines would be limited by integers (and not by floats,
> for example). I'd say something like "followlines expects a line number
> or a range" (considering the 2nd patch) has good balance between
> simplicity and precision, and if user decides to use 3.14 as a line
> number or a range bound, then getintrange() should complain at that
> specifically.

Makes sense. I just wanted to simplify the code in this patch. I'll update
the error messages and resend.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH STABLE] revlog: make sure we never use sparserevlog without general delta (issue6056)

2019-01-31 Thread Yuya Nishihara
On Thu, 31 Jan 2019 10:12:25 -0500, Boris FELD wrote:
> On 30/01/2019 17:43, Yuya Nishihara wrote:
> > On Wed, 30 Jan 2019 14:18:29 -0500, Boris FELD wrote:
> >> On 29/01/2019 07:11, Yuya Nishihara wrote:
> >>> On Tue, 29 Jan 2019 09:25:34 +0100, Mathias De Maré wrote:
>  On Mon, Jan 28, 2019 at 1:21 PM Yuya Nishihara  wrote:
> > On Fri, 25 Jan 2019 15:00:52 -0500, Boris Feld wrote:
> >> # HG changeset patch
> >> # User Boris Feld 
> >> # Date 1548372167 18000
> >> #  Thu Jan 24 18:22:47 2019 -0500
> >> # Branch stable
> >> # Node ID c7661fdcaeac457aa5b8ae6b6a10b259713934b9
> >> # Parent  26ee61c33dee366576a0f7266fea9834985e78ec
> >> # EXP-Topic issue6056
> >> # Available At https://bitbucket.org/octobus/mercurial-devel/
> >> #  hg pull https://bitbucket.org/octobus/mercurial-devel/
> > -r c7661fdcaeac
> >> revlog: make sure we never use sparserevlog without general delta
> > (issue6056)
> >> We are getting user report where the delta code tries to use
> > `sparse-revlog`
> >> logic on repository where `generaldelta` is disabled. This can't work 
> >> so
> > we
> >> ensure the two booleans have a consistent value.
> >>
> >> Creating this kind of repository is not expected to be possible and we
> > weren't
> >> able to create one for testing purpose. But if users run into this, we
> > better
> >> put stronger protection.
> > Mathias, do you have any idea how the broken repository could be 
> > created?
> >
>  I think the issue might be related to our use of streaming clonebundles 
>  and
>  a mismatch between some repositories on our server.
>  For one specific repository, I see on the server that .hg/requires 
>  contains
>  "revlogv1 store fncache dotencode".
>  On the client that cloned (and cannot commit), the requires contains:
>  "dotencode fncache generaldelta revlogv1 sparserevlog store"
> >>> That makes sense, thanks.
> >>>
> >>> The problem could be reproduced by adding --config 
> >>> format.usegeneraldelta=0
> >>> --config format.sparse-revlog=0 to test-clonebundles.t.
> >> Where are you adding this? We could not reproduce on our side.
> > Added it to "hg init server", and some repository mutation to clones.
> Do you have an exact patch to share? Adding it to `init` only was not
> enough.

Maybe this isn't the best way to reproduce the issue, but it failed:

diff --git a/tests/test-clonebundles.t b/tests/test-clonebundles.t
--- a/tests/test-clonebundles.t
+++ b/tests/test-clonebundles.t
@@ -2,7 +2,7 @@
 
 Set up a server
 
-  $ hg init server
+  $ hg init server --config format.usegeneraldelta=0 --config 
format.sparse-revlog=0
   $ cd server
   $ cat >> .hg/hgrc << EOF
   > [extensions]
@@ -295,7 +295,7 @@ Stream clone bundles are supported
 
   $ hg -R server debugcreatestreamclonebundle packed.hg
   writing 613 bytes for 4 files
-  bundle requirements: generaldelta, revlogv1, sparserevlog
+  bundle requirements: revlogv1
 
 No bundle spec should work
 
@@ -310,6 +310,67 @@ No bundle spec should work
   finished applying clone bundle
   searching for changes
   no changes found
+  $ cat stream-clone-no-spec/.hg/requires
+  dotencode
+  fncache
+  generaldelta
+  revlogv1
+  sparserevlog
+  store
+  $ hg debugrevlog stream-clone-no-spec/.hg/store/00manifest.i
+  format : 1
+  flags  : inline
+  
+  revisions :   2
+  merges:   0 ( 0.00%)
+  normal:   2 (100.00%)
+  revisions :   2
+  empty :   0 ( 0.00%)
+ text  :   0 (100.00%)
+ delta :   0 (100.00%)
+  snapshot  :   1 (50.00%)
+lvl-0   : 1 (50.00%)
+  deltas:   1 (50.00%)
+  revision size : 103
+  snapshot  :  46 (44.66%)
+lvl-0   :46 (44.66%)
+  deltas:  57 (55.34%)
+  
+  chunks:   2
+  0x00  :   1 (50.00%)
+  0x75 (u)  :   1 (50.00%)
+  chunks size   : 103
+  0x00  :  57 (55.34%)
+  0x75 (u)  :  46 (44.66%)
+  
+  avg chain length  :   0
+  max chain length  :   1
+  max chain reach   : 103
+  compression ratio :   1
+  
+  uncompressed data size (min/max/avg) : 45 / 90 / 67
+  full revision size (min/max/avg) : 46 / 46 / 46
+  inter-snapshot size (min/max/avg): 0 / 0 / 0
+  delta size (min/max/avg) : 57 / 57 / 57
+  
+  deltas against prev  : 1 (100.00%)
+  where prev = p1  : 1 (100.00%)
+  where prev = p2  : 0 ( 0.00%)
+  other: 0 ( 0.00%)
+  $ cd stream-clone-no-spec
+  $ touch a
+  $ hg ci -Am a 2>&1 | grep -v '^  '
+  adding a
+  transaction abort!
+  rollback completed
+  ** unknown exception encountered, please report by visiting
+  ** https://mercurial-scm.org/wiki/BugTracker
+  ** Python 2.7.15+ (default, Nov 28 2018, 16:27:22) [GCC 8.2.0]
+  ** Mercurial Distributed SCM (version 4.9rc0+144-e0926bcc387e)
+  ** Extensions loaded: 
+  Traceback (most 

D5744: commit: ignore diff whitespace settings when doing `commit -i` (issue5839)

2019-01-31 Thread spectral (Kyle Lippincott)
spectral added a comment.


  > I could see this being something like the following, to make it look at 
commands.commit.interactive.ignorews (and others):
  > 
  >   diffopts = patch.difffeatureopts(repo.ui, section='commands', 
configprefix='commit.interactive.', whitespace=True)
  >
  >
  > 
  > I think I like that option, I'll send a patch for it.
  
  When writing the commit description for that patch, I mentioned several times 
how I don't expect anyone to actually use the new config options I was 
creating.  I think I'll go a different direction: just add support to 
difffeatureopts to ignore the config (only respect commandline flags).

REPOSITORY
  rHG Mercurial

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

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


D5786: blackbox: support blackbox.notrack regex patterns to exclude tracking events

2019-01-31 Thread spectral (Kyle Lippincott)
spectral updated this revision to Diff 13659.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5786?vs=13656=13659

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

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

CHANGE DETAILS

diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -396,6 +396,47 @@
   invalid blackbox.track setting: nothing to repeat
   $ cd $TESTTMP
 
+test blackbox.notrack setting
+
+(test that setting this on the commandline works, and doesn't record the 'init'
+command)
+  $ hg --config blackbox.track='*' \
+  >--config blackbox.notrack='.*' \
+  >init test_notrack
+  $ cd test_notrack
+  $ cat >> .hg/hgrc << EOF
+  > [blackbox]
+  > logsource = True
+  > # a rather odd way of writing 'track = command' :)
+  > track = command.*
+  > notrack = comand..*
+  > EOF
+(this should only have 'command', and not have 'commandfinish' or others)
+  $ hg blackbox
+  1970/01/01 00:00:00 bob @ (5000) 
[command]> blackbox
+  $ cd $TESTTMP
+
+invalid regex entries in blackbox.notrack cause it to be silently ignored
+
+  $ hg --config blackbox.track='command.*' \
+  >--config blackbox.notrack=')' \
+  >init test_notrack_invalid
+  $ cd test_notrack_invalid
+  $ cat >> .hg/hgrc << EOF
+  > [blackbox]
+  > logsource = True
+  > track = command.*
+  > # invalid: "nothing to repeat"
+  > notrack = comand..**
+  > [alias]
+  > blackboxalias = blackbox
+  > EOF
+  $ hg blackboxalias
+  1970/01/01 00:00:00 bob @ (5000)> 
--config 'blackbox.track=command.*' --config 'blackbox.notrack=)' init 
test_notrack_invalid exited 0 after * seconds (glob)
+  1970/01/01 00:00:00 bob @ (5000) 
[command]> blackboxalias
+  1970/01/01 00:00:00 bob @ (5000) 
[commandalias]> alias 'blackboxalias' expands to 'blackbox'
+  $ cd $TESTTMP
+
 #if chg
 
 when using chg, blackbox.log should get rotated correctly
diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -10,9 +10,16 @@
 
 Logs event information to .hg/blackbox.log to help debug and diagnose problems.
 
-The events that get logged can be configured via the blackbox.track config key;
-this takes a list of regular expressions. As a special rule, if any item in the
-list is the string '*', everything is logged (default: '*').
+The events that get logged can be configured via the blackbox.track and
+blackbox.notrack config keys; these take a list of regular expressions. If an
+event matches an item in blackbox.notrack, it is not logged, otherwise if it
+matches an item in blackbox.track, it is logged.
+
+If blackbox.track contains an item that is just '*', blackbox.track matches
+everything (but blackbox.notrack still takes precedence).
+
+By default, blackbox.track=* and blackbox.untrack is empty, causing all events
+to be logged.
 
 Examples::
 
@@ -29,11 +36,18 @@
   # log every event starting with 'command' (including 'command' itself), and
   # everything ending with 'hook' (including 'hook' itself).
   track = command.*, .*hook
+  # explicitly ignore pythonhook
+  notrack = pythonhook
 
   [blackbox]
   track = incoming
 
   [blackbox]
+  # track = * is the default, so doesn't need to be specified here;
+  # this ignores events ending with 'hook' (and 'hook' itself)
+  notrack = .*hook
+
+  [blackbox]
   # limit the size of a log file
   maxsize = 1.5 MB
   # rotate up to N log files when the current one gets too big
@@ -90,6 +104,9 @@
 configitem('blackbox', 'track',
 default=lambda: ['*'],
 )
+configitem('blackbox', 'notrack',
+default=lambda: [],
+)
 configitem('blackbox', 'date-format',
 default='%Y/%m/%d %H:%M:%S',
 )
@@ -111,12 +128,26 @@
 except re.error as e:
 ui.warn(_('invalid blackbox.track setting: %s\n') % e)
 self._active = False
+
+self._notrackedevents = None
+notrack = ui.configlist('blackbox', 'notrack')
+if notrack:  # re.compile('').match matches *everything*
+try:
+self._notrackedevents = re.compile(br'|'.join(notrack))
+except re.error as e:
+# logging too much is usually less of a problem, so we just
+# (mostly) silently accept this.
+ui.debug('invalid blackbox.notrack setting: %s\n' % e)
+
 self._maxfiles = ui.configint('blackbox', 'maxfiles')
 self._maxsize = ui.configbytes('blackbox', 'maxsize')
 self._inlog = False
 
 def tracked(self, event):
-return self._active and self._trackedevents.match(event)
+return (self._active and
+(not self._notrackedevents or
+ not self._notrackedevents.match(event)) and
+self._trackedevents.match(event))
 
 def 

D5785: blackbox: take regex patterns for blackbox.track

2019-01-31 Thread spectral (Kyle Lippincott)
spectral updated this revision to Diff 13658.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5785?vs=13655=13658

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

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

CHANGE DETAILS

diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -23,8 +23,8 @@
   > confuse = log --limit 3
   > so-confusing = confuse --style compact
   > [blackbox]
-  > track = backupbundle, branchcache, command, commandalias, commandexception,
-  > commandfinish, debug, exthook, incoming, pythonhook, tagscache
+  > track = backupbundle, branchcache, command.*,
+  > debug, exthook, incoming, pythonhook, tagscache
   > EOF
 
   $ hg init blackboxtest
@@ -383,6 +383,19 @@
   1970/01/01 00:00:00 bob @ (5000) 
[command]> blackbox
   $ cd $TESTTMP
 
+invalid regex entries in blackbox.track are interpreted as log nothing
+
+  $ hg --config blackbox.track='**' init track_invalid_regex
+  invalid blackbox.track setting: nothing to repeat
+  $ cd track_invalid_regex
+  $ cat >> .hg/hgrc << EOF
+  > [blackbox]
+  > track = **
+  > EOF
+  $ hg blackbox
+  invalid blackbox.track setting: nothing to repeat
+  $ cd $TESTTMP
+
 #if chg
 
 when using chg, blackbox.log should get rotated correctly
diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -9,20 +9,26 @@
 """log repository events to a blackbox for debugging
 
 Logs event information to .hg/blackbox.log to help debug and diagnose problems.
-The events that get logged can be configured via the blackbox.track config key.
+
+The events that get logged can be configured via the blackbox.track config key;
+this takes a list of regular expressions. As a special rule, if any item in the
+list is the string '*', everything is logged (default: '*').
 
 Examples::
 
   [blackbox]
+  # log everything
   track = *
   # dirty is *EXPENSIVE* (slow);
   # each log entry indicates `+` if the repository is dirty, like :hg:`id`.
   dirty = True
   # record the source of log messages
   logsource = True
 
   [blackbox]
-  track = command, commandfinish, commandexception, exthook, pythonhook
+  # log every event starting with 'command' (including 'command' itself), and
+  # everything ending with 'hook' (including 'hook' itself).
+  track = command.*, .*hook
 
   [blackbox]
   track = incoming
@@ -93,13 +99,24 @@
 class blackboxlogger(object):
 def __init__(self, ui, repo):
 self._repo = repo
-self._trackedevents = set(ui.configlist('blackbox', 'track'))
+self._active = True
+track = ui.configlist('blackbox', 'track')
+if not track:
+self._active = False
+elif b'*' in track:
+self._trackedevents = re.compile(b'.*')
+else:
+try:
+self._trackedevents = re.compile(b'|'.join(track))
+except re.error as e:
+ui.warn(_('invalid blackbox.track setting: %s\n') % e)
+self._active = False
 self._maxfiles = ui.configint('blackbox', 'maxfiles')
 self._maxsize = ui.configbytes('blackbox', 'maxsize')
 self._inlog = False
 
 def tracked(self, event):
-return b'*' in self._trackedevents or event in self._trackedevents
+return self._active and self._trackedevents.match(event)
 
 def log(self, ui, event, msg, opts):
 # self._log() -> ctx.dirty() may create new subrepo instance, which
@@ -138,7 +155,7 @@
 fp.write(fmt % args)
 except (IOError, OSError) as err:
 # deactivate this to avoid failed logging again
-self._trackedevents.clear()
+self._active = False
 ui.debug('warning: cannot write to blackbox.log: %s\n' %
  encoding.strtolocal(err.strerror))
 return



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


D5784: blackbox: test that track=* works to log everything

2019-01-31 Thread spectral (Kyle Lippincott)
spectral updated this revision to Diff 13657.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5784?vs=13654=13657

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

AFFECTED FILES
  tests/test-blackbox.t

CHANGE DETAILS

diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -365,6 +365,24 @@
   $ hg blackbox
   $ cd $TESTTMP
 
+a '*' entry in blackbox.track is interpreted as log everything
+
+  $ hg --config blackbox.track='*' \
+  >--config blackbox.logsource=True \
+  >init track_star
+  $ cd track_star
+  $ cat >> .hg/hgrc << EOF
+  > [blackbox]
+  > logsource = True
+  > track = *
+  > EOF
+(only look for entries with specific logged sources, otherwise this test is
+pretty brittle)
+  $ hg blackbox | egrep '\[command(finish)?\]'
+  1970/01/01 00:00:00 bob @ (5000) 
[commandfinish]> --config 'blackbox.track=*' --config 'blackbox.logsource=True' 
init track_star exited 0 after * seconds (glob)
+  1970/01/01 00:00:00 bob @ (5000) 
[command]> blackbox
+  $ cd $TESTTMP
+
 #if chg
 
 when using chg, blackbox.log should get rotated correctly



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


D5786: blackbox: support blackbox.notrack regex patterns to exclude tracking events

2019-01-31 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS

diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -396,6 +396,26 @@
   invalid blackbox.track setting: nothing to repeat
   $ cd $TESTTMP
 
+test blackbox.notrack setting
+
+(test that setting this on the commandline works, and doesn't record the 'init'
+command)
+  $ hg --config blackbox.track='*' \
+  >--config blackbox.notrack='.*' \
+  >init test_notrack
+  $ cd test_notrack
+  $ cat >> .hg/hgrc << EOF
+  > [blackbox]
+  > logsource = True
+  > # a rather odd way of writing 'track = command' :)
+  > track = command.*
+  > notrack = comand..*
+  > EOF
+(this should only have 'command', and not have 'commandfinish' or others)
+  $ hg blackbox
+  1970/01/01 00:00:00 bob @ (5000) 
[command]> blackbox
+  $ cd $TESTTMP
+
 #if chg
 
 when using chg, blackbox.log should get rotated correctly
diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -10,9 +10,16 @@
 
 Logs event information to .hg/blackbox.log to help debug and diagnose problems.
 
-The events that get logged can be configured via the blackbox.track config key;
-this takes a list of regular expressions. As a special rule, if any item in the
-list is the string '*', everything is logged (default: '*').
+The events that get logged can be configured via the blackbox.track and
+blackbox.notrack config keys; these take a list of regular expressions. If an
+event matches an item in blackbox.notrack, it is not logged, otherwise if it
+matches an item in blackbox.track, it is logged.
+
+If blackbox.track contains an item that is just '*', blackbox.track matches
+everything (but blackbox.notrack still takes precedence).
+
+By default, blackbox.track=* and blackbox.untrack is empty, causing all events
+to be logged.
 
 Examples::
 
@@ -29,11 +36,18 @@
   # log every event starting with 'command' (including 'command' itself), and
   # everything ending with 'hook' (including 'hook' itself).
   track = command.*, .*hook
+  # explicitly ignore pythonhook
+  notrack = pythonhook
 
   [blackbox]
   track = incoming
 
   [blackbox]
+  # track = * is the default, so doesn't need to be specified here;
+  # this ignores events ending with 'hook' (and 'hook' itself)
+  notrack = .*hook
+
+  [blackbox]
   # limit the size of a log file
   maxsize = 1.5 MB
   # rotate up to N log files when the current one gets too big
@@ -90,6 +104,9 @@
 configitem('blackbox', 'track',
 default=lambda: ['*'],
 )
+configitem('blackbox', 'notrack',
+default=lambda: [],
+)
 configitem('blackbox', 'date-format',
 default='%Y/%m/%d %H:%M:%S',
 )
@@ -111,12 +128,27 @@
 except re.error as e:
 ui.warn('invalid blackbox.track setting: %s\n' % e)
 self._active = False
+
+notrack = ui.configlist('blackbox', 'notrack')
+if notrack:
+try:
+self._notrackedevents = re.compile(br'|'.join(notrack))
+except re.error as e:
+# logging too much is usually less of a problem, so we just
+# (mostly) silently accept this.
+ui.debug('invalid blackbox.notrack setting: %s\n' % e)
+else:
+self._notrackedevents = None
+
 self._maxfiles = ui.configint('blackbox', 'maxfiles')
 self._maxsize = ui.configbytes('blackbox', 'maxsize')
 self._inlog = False
 
 def tracked(self, event):
-return self._active and self._trackedevents.match(event)
+return (self._active and
+(not self._notrackedevents or
+ not self._notrackedevents.match(event)) and
+self._trackedevents.match(event))
 
 def log(self, ui, event, msg, opts):
 # self._log() -> ctx.dirty() may create new subrepo instance, which



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


D5785: blackbox: take regex patterns for blackbox.track

2019-01-31 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS

diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -23,8 +23,8 @@
   > confuse = log --limit 3
   > so-confusing = confuse --style compact
   > [blackbox]
-  > track = backupbundle, branchcache, command, commandalias, commandexception,
-  > commandfinish, debug, exthook, incoming, pythonhook, tagscache
+  > track = backupbundle, branchcache, command.*,
+  > debug, exthook, incoming, pythonhook, tagscache
   > EOF
 
   $ hg init blackboxtest
@@ -383,6 +383,19 @@
   1970/01/01 00:00:00 bob @ (5000) 
[command]> blackbox
   $ cd $TESTTMP
 
+invalid regex entries in blackbox.track are interpreted as log nothing
+
+  $ hg --config blackbox.track='**' init track_invalid_regex
+  invalid blackbox.track setting: nothing to repeat
+  $ cd track_invalid_regex
+  $ cat >> .hg/hgrc << EOF
+  > [blackbox]
+  > track = **
+  > EOF
+  $ hg blackbox
+  invalid blackbox.track setting: nothing to repeat
+  $ cd $TESTTMP
+
 #if chg
 
 when using chg, blackbox.log should get rotated correctly
diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -9,20 +9,26 @@
 """log repository events to a blackbox for debugging
 
 Logs event information to .hg/blackbox.log to help debug and diagnose problems.
-The events that get logged can be configured via the blackbox.track config key.
+
+The events that get logged can be configured via the blackbox.track config key;
+this takes a list of regular expressions. As a special rule, if any item in the
+list is the string '*', everything is logged (default: '*').
 
 Examples::
 
   [blackbox]
+  # log everything
   track = *
   # dirty is *EXPENSIVE* (slow);
   # each log entry indicates `+` if the repository is dirty, like :hg:`id`.
   dirty = True
   # record the source of log messages
   logsource = True
 
   [blackbox]
-  track = command, commandfinish, commandexception, exthook, pythonhook
+  # log every event starting with 'command' (including 'command' itself), and
+  # everything ending with 'hook' (including 'hook' itself).
+  track = command.*, .*hook
 
   [blackbox]
   track = incoming
@@ -93,13 +99,24 @@
 class blackboxlogger(object):
 def __init__(self, ui, repo):
 self._repo = repo
-self._trackedevents = set(ui.configlist('blackbox', 'track'))
+self._active = True
+track = ui.configlist('blackbox', 'track')
+if not track:
+self._active = False
+elif b'*' in track:
+self._trackedevents = re.compile(b'.*')
+else:
+try:
+self._trackedevents = re.compile(b'|'.join(track))
+except re.error as e:
+ui.warn('invalid blackbox.track setting: %s\n' % e)
+self._active = False
 self._maxfiles = ui.configint('blackbox', 'maxfiles')
 self._maxsize = ui.configbytes('blackbox', 'maxsize')
 self._inlog = False
 
 def tracked(self, event):
-return b'*' in self._trackedevents or event in self._trackedevents
+return self._active and self._trackedevents.match(event)
 
 def log(self, ui, event, msg, opts):
 # self._log() -> ctx.dirty() may create new subrepo instance, which
@@ -138,7 +155,7 @@
 fp.write(fmt % args)
 except (IOError, OSError) as err:
 # deactivate this to avoid failed logging again
-self._trackedevents.clear()
+self._active = False
 ui.debug('warning: cannot write to blackbox.log: %s\n' %
  encoding.strtolocal(err.strerror))
 return



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


D5784: blackbox: test that track=* works to log everything

2019-01-31 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-blackbox.t

CHANGE DETAILS

diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -365,6 +365,24 @@
   $ hg blackbox
   $ cd $TESTTMP
 
+a '*' entry in blackbox.track is interpreted as log everything
+
+  $ hg --config blackbox.track='*' \
+  >--config blackbox.logsource=True \
+  >init track_star
+  $ cd track_star
+  $ cat >> .hg/hgrc << EOF
+  > [blackbox]
+  > logsource = True
+  > track = *
+  > EOF
+(only look for entries with specific logged sources, otherwise this test is
+pretty brittle)
+  $ hg blackbox | egrep '\[command(finish)?\]'
+  1970/01/01 00:00:00 bob @ (5000) 
[commandfinish]> --config 'blackbox.track=*' --config 'blackbox.logsource=True' 
init track_star exited 0 after 0.03 seconds
+  1970/01/01 00:00:00 bob @ (5000) 
[command]> blackbox
+  $ cd $TESTTMP
+
 #if chg
 
 when using chg, blackbox.log should get rotated correctly



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


D5783: blackbox: test that unsetting track disables blackbox logging

2019-01-31 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-blackbox.t

CHANGE DETAILS

diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -354,6 +354,17 @@
   warning: cannot write to blackbox.log: $TESTTMP/gone/.hg/blackbox.log: 
$ENOTDIR$ (windows !)
   $ cd ..
 
+blackbox should disable itself if track is empty
+
+  $ hg --config blackbox.track= init nothing_tracked
+  $ cd nothing_tracked
+  $ cat >> .hg/hgrc << EOF
+  > [blackbox]
+  > track =
+  > EOF
+  $ hg blackbox
+  $ cd $TESTTMP
+
 #if chg
 
 when using chg, blackbox.log should get rotated correctly



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


D5744: commit: ignore diff whitespace settings when doing `commit -i` (issue5839)

2019-01-31 Thread spectral (Kyle Lippincott)
spectral added a comment.


  In https://phab.mercurial-scm.org/D5744#84781, @navaneeth.suresh wrote:
  
  > Sorry for bumping this up. I worked on a similar issue on 
https://phab.mercurial-scm.org/D5490. My initial revision was similar to this 
one. @spectral Don't you think it'll affect record extension which was written 
with zero test coverage? Please don't feel obligated. I am just being curious.
  
  
  I wasn't able to come up with a reason to support these but only when 
committing interactively (as I said in the commit description), but I guess 
there's justification in 
https://www.mercurial-scm.org/pipermail/mercurial-devel/2011-June/032316.html.
  
  So I think I can understand why this is desired for this command. Maybe a 
better option is to change the difffeatureopts() call to replace the section 
that it looks in? i.e. change:
  
diffopts = patch.difffeatureopts(repo.ui, whitespace=True)
  
  to:
  
diffopts = patch.difffeatureopts(repo.ui, section='commands-interactive', 
whitespace=True)
  
  This way we aren't looking at the `[diff]` section, so the options specified 
on the commandline end up working, and if someone really does want this as a 
default, they can get that behavior.
  
  I'm not at all attached to that section name, i.e. I could see this being 
something like the following, to make it look at 
commands.commit.interactive.ignorews (and others):
  
diffopts = patch.difffeatureopts(repo.ui, section='commands', 
configprefix='commit.interactive.', whitespace=True)
  
  I think I like that option, I'll send a patch for it.

REPOSITORY
  rHG Mercurial

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

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


D5749: hgweb: log error before attempting I/O

2019-01-31 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.


  In https://phab.mercurial-scm.org/D5749#84825, @durin42 wrote:
  
  > In https://phab.mercurial-scm.org/D5749#84719, @mharbison72 wrote:
  >
  > > In https://phab.mercurial-scm.org/D5749#84640, @indygreg wrote:
  > >
  > > > @durin42 and I were both able to produce intermittent failures with 
this change. Why, I'm not sure.
  > > >
  > > > Does the Windows regression occur with this patch or with 
https://phab.mercurial-scm.org/D5751? I ask because the behavior of 
`socket.shutdown()` is documented to vary by platform. I wouldn't at all be 
surprised if https://phab.mercurial-scm.org/D5751 caused the regression seen 
here.
  > >
  > >
  > > It was this patch.
  > >
  > > Like I said, I’ve seen connection resets in the non-daemonized serve 
output (don’t recall if it was push, pull, or both). I thought it was weird, 
but there were no other signs of problems, so I wrote it off as some odd 
Windows thing. (Not sure that I’ve seen it on Linux or OS X too)
  >
  >
  > Does https://phab.mercurial-scm.org/D5764 help the situation? It made a big 
difference for me.
  
  
  That helps a lot.  I was able to run this ~200 times in --loop without issue 
(with py3).  Then I got a few flyers:
  
--- d:/mercurial/tests/test-hgweb-filelog.t
+++ d:/mercurial/tests/test-hgweb-filelog.t.err
@@ -1843,5 +1843,19 @@
 errors

   $ cat errors.log
+  $LOCALIP - - [$ERRDATE$] Exception happened during processing request 
'/log/3/a?linerange=1:a':
+  Traceback (most recent call last):
+File "d:\mercurial\mercurial\hgweb\server.py", line 102, in do_POST
+  self.do_write()
+File "d:\mercurial\mercurial\hgweb\server.py", line 95, in do_write
+  self.do_hgweb()
+File "d:\mercurial\mercurial\hgweb\server.py", line 204, in do_hgweb
+  self._write(chunk)
+File "d:\mercurial\mercurial\hgweb\server.py", line 255, in _write
+  self.wfile.write(data)
+File "C:\Program Files\Python37\Lib\socketserver.py", line 796, in 
write
+  self._sock.sendall(b)
+  ConnectionAbortedError: [WinError 10053] An established connection was 
aborted by the software in your host machine
+

   $ cd ..

ERROR: test-hgweb-filelog.t output changed
!..
--- d:/mercurial/tests/test-hgweb.t
+++ d:/mercurial/tests/test-hgweb.t.err
@@ -911,6 +911,10 @@
 errors

   $ cat errors.log | "$PYTHON" $TESTDIR/filtertraceback.py
+  $LOCALIP - - [$ERRDATE$] Exception happened during processing request 
'/spam':\r (esc)
+  Traceback (most recent call last):\r (esc)
+  ConnectionAbortedError: [WinError 10053] An established connection was 
aborted by the software in your host machine\r (esc)
+  \r (esc)
   $ rm -f errors.log

 Uncaught exceptions result in a logged error and canned HTTP response

ERROR: test-hgweb.t output changed
  
  So there might be a small race here, but I'm not concerned, given how rare it 
is.

REPOSITORY
  rHG Mercurial

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

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


D5774: subrepo: clean up lingering bytes/str issues in svn support

2019-01-31 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfe2c826533a7: subrepo: clean up lingering bytes/str issues 
in svn support (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5774?vs=13636=13652

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

AFFECTED FILES
  mercurial/subrepo.py

CHANGE DETAILS

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -961,6 +961,7 @@
  universal_newlines=True,
  env=procutil.tonativeenv(env), **extrakw)
 stdout, stderr = p.communicate()
+stdout, stderr = pycompat.fsencode(stdout), pycompat.fsencode(stderr)
 stderr = stderr.strip()
 if not failok:
 if p.returncode:
@@ -987,13 +988,14 @@
 # both. We used to store the working directory one.
 output, err = self._svncommand(['info', '--xml'])
 doc = xml.dom.minidom.parseString(output)
-entries = doc.getElementsByTagName('entry')
+entries = doc.getElementsByTagName(r'entry')
 lastrev, rev = '0', '0'
 if entries:
-rev = str(entries[0].getAttribute('revision')) or '0'
-commits = entries[0].getElementsByTagName('commit')
+rev = pycompat.bytestr(entries[0].getAttribute(r'revision')) or '0'
+commits = entries[0].getElementsByTagName(r'commit')
 if commits:
-lastrev = str(commits[0].getAttribute('revision')) or '0'
+lastrev = pycompat.bytestr(
+commits[0].getAttribute(r'revision')) or '0'
 return (lastrev, rev)
 
 def _wcrev(self):
@@ -1008,19 +1010,19 @@
 output, err = self._svncommand(['status', '--xml'])
 externals, changes, missing = [], [], []
 doc = xml.dom.minidom.parseString(output)
-for e in doc.getElementsByTagName('entry'):
-s = e.getElementsByTagName('wc-status')
+for e in doc.getElementsByTagName(r'entry'):
+s = e.getElementsByTagName(r'wc-status')
 if not s:
 continue
-item = s[0].getAttribute('item')
-props = s[0].getAttribute('props')
-path = e.getAttribute('path')
-if item == 'external':
+item = s[0].getAttribute(r'item')
+props = s[0].getAttribute(r'props')
+path = e.getAttribute(r'path').encode('utf8')
+if item == r'external':
 externals.append(path)
-elif item == 'missing':
+elif item == r'missing':
 missing.append(path)
-if (item not in ('', 'normal', 'unversioned', 'external')
-or props not in ('', 'none', 'normal')):
+if (item not in (r'', r'normal', r'unversioned', r'external')
+or props not in (r'', r'none', r'normal')):
 changes.append(path)
 for path in changes:
 for ext in externals:
@@ -1141,14 +1143,14 @@
 output = self._svncommand(['list', '--recursive', '--xml'])[0]
 doc = xml.dom.minidom.parseString(output)
 paths = []
-for e in doc.getElementsByTagName('entry'):
-kind = pycompat.bytestr(e.getAttribute('kind'))
+for e in doc.getElementsByTagName(r'entry'):
+kind = pycompat.bytestr(e.getAttribute(r'kind'))
 if kind != 'file':
 continue
-name = ''.join(c.data for c
-   in e.getElementsByTagName('name')[0].childNodes
-   if c.nodeType == c.TEXT_NODE)
-paths.append(name.encode('utf-8'))
+name = r''.join(c.data for c
+in e.getElementsByTagName(r'name')[0].childNodes
+if c.nodeType == c.TEXT_NODE)
+paths.append(name.encode('utf8'))
 return paths
 
 def filedata(self, name, decode):



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


D5746: status: introduce higher-level ui.relative-paths

2019-01-31 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG784594080ad4: status: introduce higher-level 
ui.relative-paths (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5746?vs=13575=13650

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/configitems.py
  mercurial/help/config.txt
  mercurial/scmutil.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
@@ -133,6 +133,22 @@
 relative paths can be requested
 
   $ cat >> $HGRCPATH < [ui]
+  > relative-paths = True
+  > EOF
+  $ hg status --cwd a
+  ? 1/in_a_1
+  ? in_a
+  ? ../b/1/in_b_1
+  ? ../b/2/in_b_2
+  ? ../b/in_b
+  ? ../in_root
+
+commands.status.relative overrides ui.relative-paths
+
+  $ cat >> $HGRCPATH < [ui]
+  > relative-paths = False
   > [commands]
   > status.relative = True
   > EOF
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -725,7 +725,9 @@
 return []
 return parents
 
-def getuipathfn(repo, relative):
+def getuipathfn(repo, relative=None):
+if relative is None:
+relative = repo.ui.configbool('ui', 'relative-paths')
 if relative:
 cwd = repo.getcwd()
 pathto = repo.pathto
diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -2331,6 +2331,9 @@
 Reduce the amount of output printed.
 (default: False)
 
+``relative-paths``
+Prefer relative paths in the UI.
+
 ``remotecmd``
 Remote command to use for clone/push/pull operations.
 (default: ``hg``)
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1233,6 +1233,9 @@
 coreconfigitem('ui', 'quietbookmarkmove',
 default=False,
 )
+coreconfigitem('ui', 'relative-paths',
+default=False,
+)
 coreconfigitem('ui', 'remotecmd',
 default='hg',
 )
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5414,7 +5414,11 @@
 repo = scmutil.unhidehashlikerevs(repo, revs, 'nowarn')
 ctx1, ctx2 = scmutil.revpair(repo, revs)
 
-relative = pats or ui.configbool('commands', 'status.relative'):
+relative = None
+if pats:
+relative = True
+elif ui.hasconfig('commands', 'status.relative'):
+relative = ui.configbool('commands', 'status.relative')
 uipathfn = scmutil.getuipathfn(repo, relative)
 
 if opts.get('print0'):



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


D5745: status: extract helper for producing relative or absolute path for UI

2019-01-31 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG1d6eae696cf1: status: extract helper for producing relative 
or absolute path for UI (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5745?vs=13574=13649

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -725,6 +725,14 @@
 return []
 return parents
 
+def getuipathfn(repo, relative):
+if relative:
+cwd = repo.getcwd()
+pathto = repo.pathto
+return lambda f: pathto(f, cwd)
+else:
+return lambda f: f
+
 def expandpats(pats):
 '''Expand bare globs when running on windows.
 On posix we assume it already has already been done by sh.'''
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5414,10 +5414,8 @@
 repo = scmutil.unhidehashlikerevs(repo, revs, 'nowarn')
 ctx1, ctx2 = scmutil.revpair(repo, revs)
 
-if pats or ui.configbool('commands', 'status.relative'):
-cwd = repo.getcwd()
-else:
-cwd = ''
+relative = pats or ui.configbool('commands', 'status.relative'):
+uipathfn = scmutil.getuipathfn(repo, relative)
 
 if opts.get('print0'):
 end = '\0'
@@ -5468,10 +5466,10 @@
 fm.context(ctx=ctx2)
 fm.data(path=f)
 fm.condwrite(showchar, 'status', '%s ', char, label=label)
-fm.plain(fmt % repo.pathto(f, cwd), label=label)
+fm.plain(fmt % uipathfn(f), label=label)
 if f in copy:
 fm.data(source=copy[f])
-fm.plain(('  %s' + end) % repo.pathto(copy[f], cwd),
+fm.plain(('  %s' + end) % uipathfn(copy[f]),
  label='status.copied')
 
 if ((ui.verbose or ui.configbool('commands', 'status.verbose'))



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


D5775: tweakdefaults: set ui.relative-paths instead of command.status.relative

2019-01-31 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG734bc82f28c3: tweakdefaults: set ui.relative-paths instead 
of command.status.relative (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5775?vs=13631=13651

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

AFFECTED FILES
  mercurial/ui.py

CHANGE DETAILS

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -58,12 +58,12 @@
 statuscopies = yes
 # Prefer curses UIs when available. Revert to plain-text with `text`.
 interface = curses
+# Make compatible commands emit cwd-relative paths by default.
+relative-paths = yes
 
 [commands]
 # Grep working directory by default.
 grep.all-files = True
-# Make `hg status` emit cwd-relative paths by default.
-status.relative = yes
 # Refuse to perform an `hg update` that would cause a file content merge
 update.check = noconflict
 # Show conflicts information in `hg status`



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


D5780: tags: avoid generating commit for an already deleted tag (issue5752)

2019-01-31 Thread navaneeth.suresh (Navaneeth Suresh)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8db09278f7e0: tags: avoid generating commit for an already 
deleted tag (issue5752) (authored by navaneeth.suresh, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5780?vs=13647=13648

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-tags.t

CHANGE DETAILS

diff --git a/tests/test-tags.t b/tests/test-tags.t
--- a/tests/test-tags.t
+++ b/tests/test-tags.t
@@ -759,3 +759,69 @@
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ (cd tags-local-clone/.hg/cache/; ls -1 tag*)
   tags2-visible
+
+Avoid writing logs on trying to delete an already deleted tag
+  $ hg init issue5752
+  $ cd issue5752
+  $ echo > a
+  $ hg commit -Am 'add a'
+  adding a
+  $ hg tag a
+  $ hg tags
+  tip1:bd7ee4f3939b
+  a  0:a8a82d372bb3
+  $ hg log
+  changeset:   1:bd7ee4f3939b
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: Added tag a for changeset a8a82d372bb3
+  
+  changeset:   0:a8a82d372bb3
+  tag: a
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: add a
+  
+  $ hg tag --remove a
+  $ hg log
+  changeset:   2:e7feacc7ec9e
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: Removed tag a
+  
+  changeset:   1:bd7ee4f3939b
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: Added tag a for changeset a8a82d372bb3
+  
+  changeset:   0:a8a82d372bb3
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: add a
+  
+  $ hg tag --remove a
+  abort: tag 'a' is already removed
+  [255]
+  $ hg log
+  changeset:   2:e7feacc7ec9e
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: Removed tag a
+  
+  changeset:   1:bd7ee4f3939b
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: Added tag a for changeset a8a82d372bb3
+  
+  changeset:   0:a8a82d372bb3
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: add a
+  
+  $ cat .hgtags
+  a8a82d372bb35b42ff736e74f07c23bcd99c371f a
+  a8a82d372bb35b42ff736e74f07c23bcd99c371f a
+   a
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5830,6 +5830,10 @@
 expectedtype = 'global'
 
 for n in names:
+if repo.tagtype(n) == 'global':
+alltags = tagsmod.findglobaltags(ui, repo)
+if alltags[n][0] == nullid:
+raise error.Abort(_("tag '%s' is already removed") % n)
 if not repo.tagtype(n):
 raise error.Abort(_("tag '%s' does not exist") % n)
 if repo.tagtype(n) != expectedtype:



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


[Bug 6068] New: Merge conflict when doing `hg shelve --interactive`

2019-01-31 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6068

Bug ID: 6068
   Summary: Merge conflict when doing `hg shelve --interactive`
   Product: Mercurial
   Version: unspecified
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: shelve
  Assignee: bugzi...@mercurial-scm.org
  Reporter: h...@pewpew.net
CC: mercurial-devel@mercurial-scm.org

$ hg init
  $ cat > foo < r0 line 1
  > r0 line 2
  > r0 line -2
  > r0 line -1
  > EOF
  $ hg ci -qAm r0
  $ cat > foo < r0 line 1
  > r0 line 2
  > dont shelve this 1
  > dont shelve this 2
  > shelve this 1
  > shelve this 2
  > r0 line -2
  > r0 line -1
  > EOF

Now, try running `hg shelve -i` and
 (curses interface): unmark the "dont shelve this" lines
 (text interface): inspect the file, 'e' to edit, remove the "+dont shelve
this" lines

You'll get a merge conflict:

$ cat foo 
r0 line 1   
r0 line 2
<<< working copy: 6471987d4ca5 - shelve: changes to: r0
dont shelve this 1
dont shelve this 2
shelve this 1
shelve this 2
||| base
shelve this 1
shelve this 2
===
>>> destination:  ff8755499cc3 - spectral: r0
r0 line -2
r0 line -1

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


D5775: tweakdefaults: set ui.relative-paths instead of command.status.relative

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


  Queued upto here. I need a refreshed brain for the next patch to find all the 
occurrences where we print file name.

REPOSITORY
  rHG Mercurial

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

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


mercurial@41455: 8 new changesets (1 on stable)

2019-01-31 Thread Mercurial Commits
8 new changesets (1 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/fa7d61f9c512
changeset:   41448:fa7d61f9c512
parent:  41445:73a33fe625bb
user:Pulkit Goyal 
date:Tue Jan 29 16:03:52 2019 +0300
summary: changegroup: don't try to build changelog chunks if not required

https://www.mercurial-scm.org/repo/hg/rev/bc776c31c093
changeset:   41449:bc776c31c093
user:Augie Fackler 
date:Tue Jan 29 13:24:20 2019 -0500
summary: url: add some defensive asserts on expected incoming types

https://www.mercurial-scm.org/repo/hg/rev/d437d1e2a711
changeset:   41450:d437d1e2a711
user:Augie Fackler 
date:Tue Jan 29 13:25:21 2019 -0500
summary: url: convert some variables back to bytes

https://www.mercurial-scm.org/repo/hg/rev/30dd20a56f3e
changeset:   41451:30dd20a56f3e
user:Augie Fackler 
date:Tue Jan 29 13:26:18 2019 -0500
summary: tests: port test-hgweb-auth.py to Python 3

https://www.mercurial-scm.org/repo/hg/rev/a03d20e36194
changeset:   41452:a03d20e36194
user:Pulkit Goyal 
date:Wed Jan 30 03:49:56 2019 +0530
summary: py3: use '%d' instead of '%s' for integers

https://www.mercurial-scm.org/repo/hg/rev/1a4a41d39dfc
changeset:   41453:1a4a41d39dfc
user:Pulkit Goyal 
date:Wed Jan 30 03:56:35 2019 +0530
summary: py3: pass str into RuntimeError() to prevent b'' in output

https://www.mercurial-scm.org/repo/hg/rev/d1d3094b54f9
changeset:   41454:d1d3094b54f9
bookmark:@
user:Kyle Lippincott 
date:Mon Jan 28 18:00:14 2019 -0800
summary: patch: handle 0 context lines (diff.unified=0) when parsing patches

https://www.mercurial-scm.org/repo/hg/rev/8427fea04017
changeset:   41455:8427fea04017
branch:  stable
tag: tip
parent:  41447:189e06b2d719
user:Anton Shestakov 
date:Thu Jan 31 13:32:21 2019 +0800
summary: copyright: update to 2019

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


D5780: tags: avoid generating commit for an already deleted tag (issue5752)

2019-01-31 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added a comment.


  @durin42 Thanks for the quick review.
  @mharbison72 Yup. I should not be making changes to the ui as this can be 
fixed simply within the call itself. My bad. I've updated the revision as per 
your suggestion, many thanks!

REPOSITORY
  rHG Mercurial

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

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


D5780: tags: avoid generating commit for an already deleted tag (issue5752)

2019-01-31 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh updated this revision to Diff 13647.
navaneeth.suresh edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5780?vs=13641=13647

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-tags.t

CHANGE DETAILS

diff --git a/tests/test-tags.t b/tests/test-tags.t
--- a/tests/test-tags.t
+++ b/tests/test-tags.t
@@ -759,3 +759,69 @@
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ (cd tags-local-clone/.hg/cache/; ls -1 tag*)
   tags2-visible
+
+Avoid writing logs on trying to delete an already deleted tag
+  $ hg init issue5752
+  $ cd issue5752
+  $ echo > a
+  $ hg commit -Am 'add a'
+  adding a
+  $ hg tag a
+  $ hg tags
+  tip1:bd7ee4f3939b
+  a  0:a8a82d372bb3
+  $ hg log
+  changeset:   1:bd7ee4f3939b
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: Added tag a for changeset a8a82d372bb3
+  
+  changeset:   0:a8a82d372bb3
+  tag: a
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: add a
+  
+  $ hg tag --remove a
+  $ hg log
+  changeset:   2:e7feacc7ec9e
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: Removed tag a
+  
+  changeset:   1:bd7ee4f3939b
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: Added tag a for changeset a8a82d372bb3
+  
+  changeset:   0:a8a82d372bb3
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: add a
+  
+  $ hg tag --remove a
+  abort: tag 'a' is already removed
+  [255]
+  $ hg log
+  changeset:   2:e7feacc7ec9e
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: Removed tag a
+  
+  changeset:   1:bd7ee4f3939b
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: Added tag a for changeset a8a82d372bb3
+  
+  changeset:   0:a8a82d372bb3
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: add a
+  
+  $ cat .hgtags
+  a8a82d372bb35b42ff736e74f07c23bcd99c371f a
+  a8a82d372bb35b42ff736e74f07c23bcd99c371f a
+   a
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5830,6 +5830,10 @@
 expectedtype = 'global'
 
 for n in names:
+if repo.tagtype(n) == 'global':
+alltags = tagsmod.findglobaltags(ui, repo)
+if alltags[n][0] == nullid:
+raise error.Abort(_("tag '%s' is already removed") % n)
 if not repo.tagtype(n):
 raise error.Abort(_("tag '%s' does not exist") % n)
 if repo.tagtype(n) != expectedtype:



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


D5749: hgweb: log error before attempting I/O

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


  In https://phab.mercurial-scm.org/D5749#84719, @mharbison72 wrote:
  
  > In https://phab.mercurial-scm.org/D5749#84640, @indygreg wrote:
  >
  > > @durin42 and I were both able to produce intermittent failures with this 
change. Why, I'm not sure.
  > >
  > > Does the Windows regression occur with this patch or with 
https://phab.mercurial-scm.org/D5751? I ask because the behavior of 
`socket.shutdown()` is documented to vary by platform. I wouldn't at all be 
surprised if https://phab.mercurial-scm.org/D5751 caused the regression seen 
here.
  >
  >
  > It was this patch.
  >
  > Like I said, I’ve seen connection resets in the non-daemonized serve output 
(don’t recall if it was push, pull, or both). I thought it was weird, but there 
were no other signs of problems, so I wrote it off as some odd Windows thing. 
(Not sure that I’ve seen it on Linux or OS X too)
  
  
  Does https://phab.mercurial-scm.org/D5764 help the situation? It made a big 
difference for me.

REPOSITORY
  rHG Mercurial

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

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


D5780: tags: avoid generating commit for an already deleted tag (issue5752)

2019-01-31 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.


  Since the tag command's code is already looking at `repo.tagtype()`, I wonder 
if it would be better to just inline the global tag lookup and nullid 
comparison right there instead of updating the interface.

REPOSITORY
  rHG Mercurial

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

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


D5782: changegroup: don't try to prune manifest nodes if not ellipses

2019-01-31 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  In non-ellipses case, the number of manifest nodes can be very big, and 
finding
  whether one of them can be pruned or not is very costly. For each node, we try
  to find the rev and the linkrev, which is expensive.
  
  Sending bit more manifest nodes seems better and much faster here. On our
  internal repository, this saves around 5 seconds on `hg tracked --addinclude
  ` on a narrow repo with ellipses disabled.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/changegroup.py

CHANGE DETAILS

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -1073,6 +1073,11 @@
 # because of narrow clones). Do this even for the root
 # directory (tree=='')
 prunednodes = []
+elif not self._ellipses:
+# In non-ellipses case and large repositories, it is better to
+# prevent calling of store.rev and store.linkrev on a lot of
+# nodes as compared to sending some extra data
+prunednodes = nodes.copy()
 else:
 # Avoid sending any manifest nodes we can prove the
 # client already has by checking linkrevs. See the



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


D5587: watchman: detect nested mercurial repositories and abort

2019-01-31 Thread lothiraldan (Boris Feld)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6a7b2d2de124: watchman: detect nested mercurial 
repositories and abort (authored by lothiraldan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5587?vs=13412=13645

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

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
@@ -367,6 +367,9 @@
 fexists = entry['exists']
 kind = getkind(fmode)
 
+if '/.hg/' in fname or fname.endswith('/.hg'):
+return bail('nested-repo-detected')
+
 if not fexists:
 # if marked as deleted and we don't already have a change
 # record, mark it as deleted.  If we already have an entry
@@ -740,6 +743,14 @@
 repo, node, branchmerge, force, ancestor, mergeancestor,
 labels, matcher, **kwargs)
 
+def repo_has_depth_one_nested_repo(repo):
+for f in repo.wvfs.listdir():
+if os.path.isdir(os.path.join(repo.root, f, '.hg')):
+msg = 'fsmonitor: sub-repository %r detected, fsmonitor disabled\n'
+repo.ui.debug(msg % f)
+return True
+return False
+
 def reposetup(ui, repo):
 # We don't work with largefiles or inotify
 exts = extensions.enabled()
@@ -757,6 +768,9 @@
 if repo.wvfs.exists('.hgsubstate') or repo.wvfs.exists('.hgsub'):
 return
 
+if repo_has_depth_one_nested_repo(repo):
+return
+
 fsmonitorstate = state.state(repo)
 if fsmonitorstate.mode == 'off':
 return



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


D5586: watchman: add verbose config knob

2019-01-31 Thread lothiraldan (Boris Feld)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG158962bf4a52: watchman: add verbose config knob (authored 
by lothiraldan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5586?vs=13411=13644

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

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
@@ -161,6 +161,9 @@
 configitem('fsmonitor', 'blacklistusers',
 default=list,
 )
+configitem('hgwatchman', 'verbose',
+default=True,
+)
 configitem('experimental', 'fsmonitor.transaction_notify',
 default=False,
 )
@@ -172,11 +175,14 @@
 def _handleunavailable(ui, state, ex):
 """Exception handler for Watchman interaction exceptions"""
 if isinstance(ex, watchmanclient.Unavailable):
-if ex.warn:
+# experimental config: hgwatchman.verbose
+if ex.warn and ui.configbool('hgwatchman', 'verbose'):
 ui.warn(str(ex) + '\n')
 if ex.invalidate:
 state.invalidate()
-ui.log('fsmonitor', 'Watchman unavailable: %s\n', ex.msg)
+# experimental config: hgwatchman.verbose
+if ui.configbool('hgwatchman','verbose'):
+ui.log('fsmonitor', 'Watchman unavailable: %s\n', ex.msg)
 else:
 ui.log('fsmonitor', 'Watchman exception: %s\n', ex)
 



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


D5780: tags: avoid generating commit for an already deleted tag (issue5752)

2019-01-31 Thread durin42 (Augie Fackler)
durin42 requested changes to this revision.
durin42 added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> localrepo.py:1484
>  
> +def alreadydeletedtag(self, tagname):
> +'''return True if given tag is already deleted'''

You'll need to update the repository interface here: 
https://www.mercurial-scm.org/repo/hg-committed/file/1aa52287973e/mercurial/repository.py#l1525

That should fix your test failure.

REPOSITORY
  rHG Mercurial

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

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


D5779: copyright: update to 2019

2019-01-31 Thread av6 (Anton Shestakov)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8427fea04017: copyright: update to 2019 (authored by av6, 
committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5779?vs=13640=13643

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

AFFECTED FILES
  contrib/packaging/debian/copyright
  contrib/win32/ReadMe.html
  contrib/win32/mercurial.iss
  contrib/wix/COPYING.rtf
  mercurial/commands.py
  mercurial/help/hg.1.txt
  mercurial/help/hgignore.5.txt
  mercurial/help/hgrc.5.txt
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1134,7 +1134,7 @@
 if py2exeloaded:
 extra['console'] = [
 {'script':'hg',
- 'copyright':'Copyright (C) 2005-2018 Matt Mackall and others',
+ 'copyright':'Copyright (C) 2005-2019 Matt Mackall and others',
  'product_version':version}]
 # sub command of 'build' because 'py2exe' does not handle sub_commands
 build.sub_commands.insert(0, ('build_hgextindex', None))
diff --git a/mercurial/help/hgrc.5.txt b/mercurial/help/hgrc.5.txt
--- a/mercurial/help/hgrc.5.txt
+++ b/mercurial/help/hgrc.5.txt
@@ -34,7 +34,7 @@
 Copying
 ===
 This manual page is copyright 2005 Bryan O'Sullivan.
-Mercurial is copyright 2005-2018 Matt Mackall.
+Mercurial is copyright 2005-2019 Matt Mackall.
 Free use of this software is granted under the terms of the GNU General
 Public License version 2 or any later version.
 
diff --git a/mercurial/help/hgignore.5.txt b/mercurial/help/hgignore.5.txt
--- a/mercurial/help/hgignore.5.txt
+++ b/mercurial/help/hgignore.5.txt
@@ -26,7 +26,7 @@
 Copying
 ===
 This manual page is copyright 2006 Vadim Gelfer.
-Mercurial is copyright 2005-2018 Matt Mackall.
+Mercurial is copyright 2005-2019 Matt Mackall.
 Free use of this software is granted under the terms of the GNU General
 Public License version 2 or any later version.
 
diff --git a/mercurial/help/hg.1.txt b/mercurial/help/hg.1.txt
--- a/mercurial/help/hg.1.txt
+++ b/mercurial/help/hg.1.txt
@@ -112,7 +112,7 @@
 
 Copying
 """
-Copyright (C) 2005-2018 Matt Mackall.
+Copyright (C) 2005-2019 Matt Mackall.
 Free use of this software is granted under the terms of the GNU General
 Public License version 2 or any later version.
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6166,7 +6166,7 @@
  util.version())
 license = _(
 "(see https://mercurial-scm.org for more information)\n"
-"\nCopyright (C) 2005-2018 Matt Mackall and others\n"
+"\nCopyright (C) 2005-2019 Matt Mackall and others\n"
 "This is free software; see the source for copying conditions. "
 "There is NO\nwarranty; "
 "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
diff --git a/contrib/wix/COPYING.rtf b/contrib/wix/COPYING.rtf
index 
..
GIT binary patch
literal 0
Hc$@
 
 
-  Mercurial is Copyright 2005-2018 Matt Mackall and others. See
+  Mercurial is Copyright 2005-2019 Matt Mackall and others. See
   the Contributors.txt file for a list of contributors.
 
 
diff --git a/contrib/packaging/debian/copyright 
b/contrib/packaging/debian/copyright
--- a/contrib/packaging/debian/copyright
+++ b/contrib/packaging/debian/copyright
@@ -3,7 +3,7 @@
 Source: https://www.mercurial-scm.org/
 
 Files: *
-Copyright: 2005-2018, Matt Mackall  and others.
+Copyright: 2005-2019, Matt Mackall  and others.
 License: GPL-2+
  This program is free software; you can redistribute it
  and/or modify it under the terms of the GNU General Public



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


D5781: py3: fix test-remotefilelog-repack.t

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

REVISION SUMMARY
  This is uglier, but more obviously correct in my opinion. I guess
  Python 3 doesn't hang on to the exception as long, which seems
  reasonable.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/python3-whitelist
  hgext/remotefilelog/basestore.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/basestore.py b/hgext/remotefilelog/basestore.py
--- a/hgext/remotefilelog/basestore.py
+++ b/hgext/remotefilelog/basestore.py
@@ -410,16 +410,18 @@
 def wrapped(self, *args, **kwargs):
 retrylog = self.retrylog or noop
 funcname = fn.__name__
-for i in pycompat.xrange(self.numattempts):
+i = 0
+while i < self.numattempts:
 if i > 0:
 retrylog('re-attempting (n=%d) %s\n' % (i, funcname))
 self.markforrefresh()
+i += 1
 try:
 return fn(self, *args, **kwargs)
 except KeyError:
-pass
-# retries exhausted
-retrylog('retries exhausted in %s, raising KeyError\n' %
- pycompat.sysbytes(funcname))
-raise
+if i == self.numattempts:
+# retries exhausted
+retrylog('retries exhausted in %s, raising KeyError\n' 
%
+ pycompat.sysbytes(funcname))
+raise
 return wrapped
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -602,6 +602,7 @@
 test-remotefilelog-permisssions.t
 test-remotefilelog-prefetch.t
 test-remotefilelog-pull-noshallow.t
+test-remotefilelog-repack.t
 test-remotefilelog-share.t
 test-remotefilelog-sparse.t
 test-remotefilelog-tags.t



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


Re: [PATCH 3 of 3] revset: leverage getintrange() helper in relation-subscript operation (API)

2019-01-31 Thread Anton Shestakov
On Thu, 31 Jan 2019 23:19:20 +0900
Yuya Nishihara  wrote:

> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1548563857 -32400
> #  Sun Jan 27 13:37:37 2019 +0900
> # Node ID 4e7cb9965efc7921427418742ff2ca23f180b707
> # Parent  d5978ebfee5ac4ec9694c8d1a2df37c7e1555bd3
> revset: leverage getintrange() helper in relation-subscript operation (API)
> 
> Now a range expression is parsed by a relation function itself since the
> upper layer have no knowledge about the default first/last bounds.
> 
> --- a/tests/test-revset.t
> +++ b/tests/test-revset.t
> @@ -643,13 +643,13 @@ parse errors of relation, subscript and 
>[255]
>  
>$ hg debugrevspec '.#generations[a]'
> -  hg: parse error: relation subscript must be an integer
> +  hg: parse error: relation subscript must be an integer range
>[255]

This doesn't feel right: it can totally be just one integer. I mean,
internally it's converted to range, but as a message to user the new
phrasing is less helpful.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 3] revset: extract a helper to parse integer range

2019-01-31 Thread Anton Shestakov
On Thu, 31 Jan 2019 23:19:18 +0900
Yuya Nishihara  wrote:

> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1548562733 -32400
> #  Sun Jan 27 13:18:53 2019 +0900
> # Node ID 5e5dda247ee2ba8407bc4932118a944c1959b1f9
> # Parent  1aa52287973e180eaf23c32dd454d38537facb8e
> revset: extract a helper to parse integer range
> 
> It's getting common. As a first step, this patch adds getintrange() and
> makes followlines() use it.
> 
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -44,6 +44,7 @@ getinteger = revsetlang.getinteger
>  getboolean = revsetlang.getboolean
>  getlist = revsetlang.getlist
>  getrange = revsetlang.getrange
> +getintrange = revsetlang.getintrange
>  getargs = revsetlang.getargs
>  getargsdict = revsetlang.getargsdict
>  
> @@ -1067,11 +1068,10 @@ def followlines(repo, subset, x):
>  # i18n: "followlines" is a keyword
>  msg = _("followlines expects exactly one file")
>  fname = scmutil.parsefollowlinespattern(repo, rev, pat, msg)
> -# i18n: "followlines" is a keyword
> -lr = getrange(args['lines'][0], _("followlines expects a line range"))
> -fromline, toline = [getinteger(a, _("line range bounds must be 
> integers"))
> -for a in lr]
> -fromline, toline = util.processlinerange(fromline, toline)
> +fromline, toline = util.processlinerange(
> +*getintrange(args['lines'][0],
> + # i18n: "followlines" is a keyword
> + _("followlines expects an integer line range")))

Maybe it's me, but I couldn't parse "integer line range" without taking
a moment to think. I think the two old messages are easier to
understand, because one is a broad description of what's expected and
the other is an error message just in case. I mean, it's already logical
that a range of lines would be limited by integers (and not by floats,
for example). I'd say something like "followlines expects a line number
or a range" (considering the 2nd patch) has good balance between
simplicity and precision, and if user decides to use 3.14 as a line
number or a range bound, then getintrange() should complain at that
specifically.

> diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py
> --- a/mercurial/revsetlang.py
> +++ b/mercurial/revsetlang.py
> @@ -240,6 +240,15 @@ def getrange(x, err):
>  return None, None
>  raise error.ParseError(err)
>  
> +def getintrange(x, err, deffirst=_notset, deflast=_notset):
> +"""Get [first, last] integer range (both inclusive) from a parsed tree
> +
> +If any of the sides omitted, and if no default provided, ParseError will
> +be raised.
> +"""
> +a, b = getrange(x, err)
> +return getinteger(a, err, deffirst), getinteger(b, err, deflast)
> +
>  def getargs(x, min, max, err):
>  l = getlist(x)
>  if len(l) < min or (max >= 0 and len(l) > max):
> diff --git a/tests/test-annotate.t b/tests/test-annotate.t
> --- a/tests/test-annotate.t
> +++ b/tests/test-annotate.t
> @@ -818,7 +818,7 @@ check error cases
>hg: parse error: followlines requires a line range
>[255]
>$ hg log -r 'followlines(baz, 1)'
> -  hg: parse error: followlines expects a line range
> +  hg: parse error: followlines expects an integer line range
>[255]
>$ hg log -r 'followlines(baz, 1:2, startrev=desc("b"))'
>hg: parse error: followlines expects exactly one revision
> @@ -827,13 +827,13 @@ check error cases
>hg: parse error: followlines expects exactly one file
>[255]
>$ hg log -r 'followlines(baz, 1:)'
> -  hg: parse error: line range bounds must be integers
> +  hg: parse error: followlines expects an integer line range
>[255]
>$ hg log -r 'followlines(baz, :1)'
> -  hg: parse error: line range bounds must be integers
> +  hg: parse error: followlines expects an integer line range
>[255]
>$ hg log -r 'followlines(baz, x:4)'
> -  hg: parse error: line range bounds must be integers
> +  hg: parse error: followlines expects an integer line range
>[255]
>$ hg log -r 'followlines(baz, 5:4)'
>hg: parse error: line range must be positive
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial@41447: 2 new changesets (2 on stable)

2019-01-31 Thread Mercurial Commits
2 new changesets (2 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/261d37b94d31
changeset:   41446:261d37b94d31
branch:  stable
parent:  41350:ab0d762d89ef
user:Boris Feld 
date:Wed Jan 30 18:15:38 2019 +0100
summary: sparserevlog: document the config option

https://www.mercurial-scm.org/repo/hg/rev/189e06b2d719
changeset:   41447:189e06b2d719
branch:  stable
tag: tip
user:Boris Feld 
date:Thu Jan 24 18:22:47 2019 -0500
summary: revlog: make sure we never use sparserevlog without general delta 
(issue6056)

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


Re: [PATCH STABLE] revlog: make sure we never use sparserevlog without general delta (issue6056)

2019-01-31 Thread Boris FELD
On 30/01/2019 17:43, Yuya Nishihara wrote:
> On Wed, 30 Jan 2019 14:18:29 -0500, Boris FELD wrote:
>> On 29/01/2019 07:11, Yuya Nishihara wrote:
>>> On Tue, 29 Jan 2019 09:25:34 +0100, Mathias De Maré wrote:
 On Mon, Jan 28, 2019 at 1:21 PM Yuya Nishihara  wrote:
> On Fri, 25 Jan 2019 15:00:52 -0500, Boris Feld wrote:
>> # HG changeset patch
>> # User Boris Feld 
>> # Date 1548372167 18000
>> #  Thu Jan 24 18:22:47 2019 -0500
>> # Branch stable
>> # Node ID c7661fdcaeac457aa5b8ae6b6a10b259713934b9
>> # Parent  26ee61c33dee366576a0f7266fea9834985e78ec
>> # EXP-Topic issue6056
>> # Available At https://bitbucket.org/octobus/mercurial-devel/
>> #  hg pull https://bitbucket.org/octobus/mercurial-devel/
> -r c7661fdcaeac
>> revlog: make sure we never use sparserevlog without general delta
> (issue6056)
>> We are getting user report where the delta code tries to use
> `sparse-revlog`
>> logic on repository where `generaldelta` is disabled. This can't work so
> we
>> ensure the two booleans have a consistent value.
>>
>> Creating this kind of repository is not expected to be possible and we
> weren't
>> able to create one for testing purpose. But if users run into this, we
> better
>> put stronger protection.
> Mathias, do you have any idea how the broken repository could be created?
>
 I think the issue might be related to our use of streaming clonebundles and
 a mismatch between some repositories on our server.
 For one specific repository, I see on the server that .hg/requires contains
 "revlogv1 store fncache dotencode".
 On the client that cloned (and cannot commit), the requires contains:
 "dotencode fncache generaldelta revlogv1 sparserevlog store"
>>> That makes sense, thanks.
>>>
>>> The problem could be reproduced by adding --config format.usegeneraldelta=0
>>> --config format.sparse-revlog=0 to test-clonebundles.t.
>> Where are you adding this? We could not reproduce on our side.
> Added it to "hg init server", and some repository mutation to clones.
Do you have an exact patch to share? Adding it to `init` only was not
enough.
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 3] revset: allow to parse single integer as a range

2019-01-31 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1548563325 -32400
#  Sun Jan 27 13:28:45 2019 +0900
# Node ID d5978ebfee5ac4ec9694c8d1a2df37c7e1555bd3
# Parent  5e5dda247ee2ba8407bc4932118a944c1959b1f9
revset: allow to parse single integer as a range

Even though this wouldn't be any useful in followlines(), it helps to unify
range processing.

diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py
--- a/mercurial/revsetlang.py
+++ b/mercurial/revsetlang.py
@@ -246,6 +246,9 @@ def getintrange(x, err, deffirst=_notset
 If any of the sides omitted, and if no default provided, ParseError will
 be raised.
 """
+if x and (x[0] == 'string' or x[0] == 'symbol'):
+n = getinteger(x, err)
+return n, n
 a, b = getrange(x, err)
 return getinteger(a, err, deffirst), getinteger(b, err, deflast)
 
diff --git a/tests/test-annotate.t b/tests/test-annotate.t
--- a/tests/test-annotate.t
+++ b/tests/test-annotate.t
@@ -809,6 +809,15 @@ track of possible further descendants in
   |\
   ~ ~
 
+An integer as a line range, which is parsed as '1:1'
+
+  $ hg log -r 'followlines(baz, 1)'
+  changeset:   22:2174d0bf352a
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: added two lines with 0
+  
+
 check error cases
   $ hg up 24 --quiet
   $ hg log -r 'followlines()'
@@ -817,9 +826,6 @@ check error cases
   $ hg log -r 'followlines(baz)'
   hg: parse error: followlines requires a line range
   [255]
-  $ hg log -r 'followlines(baz, 1)'
-  hg: parse error: followlines expects an integer line range
-  [255]
   $ hg log -r 'followlines(baz, 1:2, startrev=desc("b"))'
   hg: parse error: followlines expects exactly one revision
   [255]
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 3] revset: extract a helper to parse integer range

2019-01-31 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1548562733 -32400
#  Sun Jan 27 13:18:53 2019 +0900
# Node ID 5e5dda247ee2ba8407bc4932118a944c1959b1f9
# Parent  1aa52287973e180eaf23c32dd454d38537facb8e
revset: extract a helper to parse integer range

It's getting common. As a first step, this patch adds getintrange() and
makes followlines() use it.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -44,6 +44,7 @@ getinteger = revsetlang.getinteger
 getboolean = revsetlang.getboolean
 getlist = revsetlang.getlist
 getrange = revsetlang.getrange
+getintrange = revsetlang.getintrange
 getargs = revsetlang.getargs
 getargsdict = revsetlang.getargsdict
 
@@ -1067,11 +1068,10 @@ def followlines(repo, subset, x):
 # i18n: "followlines" is a keyword
 msg = _("followlines expects exactly one file")
 fname = scmutil.parsefollowlinespattern(repo, rev, pat, msg)
-# i18n: "followlines" is a keyword
-lr = getrange(args['lines'][0], _("followlines expects a line range"))
-fromline, toline = [getinteger(a, _("line range bounds must be integers"))
-for a in lr]
-fromline, toline = util.processlinerange(fromline, toline)
+fromline, toline = util.processlinerange(
+*getintrange(args['lines'][0],
+ # i18n: "followlines" is a keyword
+ _("followlines expects an integer line range")))
 
 fctx = repo[rev].filectx(fname)
 descend = False
diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py
--- a/mercurial/revsetlang.py
+++ b/mercurial/revsetlang.py
@@ -240,6 +240,15 @@ def getrange(x, err):
 return None, None
 raise error.ParseError(err)
 
+def getintrange(x, err, deffirst=_notset, deflast=_notset):
+"""Get [first, last] integer range (both inclusive) from a parsed tree
+
+If any of the sides omitted, and if no default provided, ParseError will
+be raised.
+"""
+a, b = getrange(x, err)
+return getinteger(a, err, deffirst), getinteger(b, err, deflast)
+
 def getargs(x, min, max, err):
 l = getlist(x)
 if len(l) < min or (max >= 0 and len(l) > max):
diff --git a/tests/test-annotate.t b/tests/test-annotate.t
--- a/tests/test-annotate.t
+++ b/tests/test-annotate.t
@@ -818,7 +818,7 @@ check error cases
   hg: parse error: followlines requires a line range
   [255]
   $ hg log -r 'followlines(baz, 1)'
-  hg: parse error: followlines expects a line range
+  hg: parse error: followlines expects an integer line range
   [255]
   $ hg log -r 'followlines(baz, 1:2, startrev=desc("b"))'
   hg: parse error: followlines expects exactly one revision
@@ -827,13 +827,13 @@ check error cases
   hg: parse error: followlines expects exactly one file
   [255]
   $ hg log -r 'followlines(baz, 1:)'
-  hg: parse error: line range bounds must be integers
+  hg: parse error: followlines expects an integer line range
   [255]
   $ hg log -r 'followlines(baz, :1)'
-  hg: parse error: line range bounds must be integers
+  hg: parse error: followlines expects an integer line range
   [255]
   $ hg log -r 'followlines(baz, x:4)'
-  hg: parse error: line range bounds must be integers
+  hg: parse error: followlines expects an integer line range
   [255]
   $ hg log -r 'followlines(baz, 5:4)'
   hg: parse error: line range must be positive
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5780: tags: avoid generating commit for an already deleted tag (issue5752)

2019-01-31 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  `$ hg tag --remove ` will keep on generating commits
  regardless of checking whether the tag is deleted or not. I added a new 
function
  `alreadydeletedtag()` which returns `True` if the tag is already deleted in
  the `localrepository` class.  Used this function to throw an error on being
  `True` when `$ hg tag` is called. This works fine for `global` tags now.
  
  Unfortunately, I'm getting the following error on testing:
  
public attribute not declared in interfaces: 
derivedrepo:/home/navaneeth/workspace/hg-stable.alreadydeletedtag

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/localrepo.py
  tests/test-tags.t

CHANGE DETAILS

diff --git a/tests/test-tags.t b/tests/test-tags.t
--- a/tests/test-tags.t
+++ b/tests/test-tags.t
@@ -759,3 +759,69 @@
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ (cd tags-local-clone/.hg/cache/; ls -1 tag*)
   tags2-visible
+
+Avoid writing logs on trying to delete an already deleted tag
+  $ hg init issue5752
+  $ cd issue5752
+  $ echo > a
+  $ hg commit -Am 'add a'
+  adding a
+  $ hg tag a
+  $ hg tags
+  tip1:bd7ee4f3939b
+  a  0:a8a82d372bb3
+  $ hg log
+  changeset:   1:bd7ee4f3939b
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: Added tag a for changeset a8a82d372bb3
+  
+  changeset:   0:a8a82d372bb3
+  tag: a
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: add a
+  
+  $ hg tag --remove a
+  $ hg log
+  changeset:   2:e7feacc7ec9e
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: Removed tag a
+  
+  changeset:   1:bd7ee4f3939b
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: Added tag a for changeset a8a82d372bb3
+  
+  changeset:   0:a8a82d372bb3
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: add a
+  
+  $ hg tag --remove a
+  abort: tag 'a' is already deleted
+  [255]
+  $ hg log
+  changeset:   2:e7feacc7ec9e
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: Removed tag a
+  
+  changeset:   1:bd7ee4f3939b
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: Added tag a for changeset a8a82d372bb3
+  
+  changeset:   0:a8a82d372bb3
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: add a
+  
+  $ cat .hgtags
+  a8a82d372bb35b42ff736e74f07c23bcd99c371f a
+  a8a82d372bb35b42ff736e74f07c23bcd99c371f a
+   a
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1481,6 +1481,14 @@
  for (name, value) in tagtypes.iteritems()])
 return (tags, tagtypes)
 
+def alreadydeletedtag(self, tagname):
+'''return True if given tag is already deleted'''
+alltags = {}
+if self.tagtype(tagname) == 'global':
+alltags = tagsmod.findglobaltags(self.ui, self)
+return (alltags[tagname][0] == nullid)
+return False
+
 def tagtype(self, tagname):
 '''
 return the type of the given tag. result can be:
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5830,6 +5830,8 @@
 expectedtype = 'global'
 
 for n in names:
+if repo.alreadydeletedtag(n):
+raise error.Abort(_("tag '%s' is already deleted") % n)
 if not repo.tagtype(n):
 raise error.Abort(_("tag '%s' does not exist") % n)
 if repo.tagtype(n) != expectedtype:



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


D5778: svnurlof: fix check-code errors I introduced

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


  > +from __future__ import absolute_import, print_function
  
  I've fixed this in flight.

REPOSITORY
  rHG Mercurial

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

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


Re: D5778: svnurlof: fix check-code errors I introduced

2019-01-31 Thread Yuya Nishihara
> +from __future__ import absolute_import, print_function

I've fixed this in flight.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D5768: subrepo: bytes/str cleanups on Git support

2019-01-31 Thread Yuya Nishihara
> -retdata = p.stdout.read().strip()
> +retdata = pycompat.fsencode(p.stdout.read().strip())

Curious why subprocess output can be a unicode. Is it a sort of text-mode
stream?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5772: hg: raise Abort on invalid path

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


  > +try:
  >  +isfile = os.path.isfile(path)
  >  +# Python 2 raises TypeError, Python 3 ValueError.
  >  +except (TypeError, ValueError) as e:
  >  +raise error.Abort(_('invalid path %s: %s') % (
  >  +path, pycompat.bytestr(e)))
  
  I don't know if the path is included in the exception message, but it's
  probably safer to use `stringutil.forcebytestr(e)` to get around possible
  UnicodeError.

REPOSITORY
  rHG Mercurial

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

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


Re: D5772: hg: raise Abort on invalid path

2019-01-31 Thread Yuya Nishihara
> +try:
> +isfile = os.path.isfile(path)
> +# Python 2 raises TypeError, Python 3 ValueError.
> +except (TypeError, ValueError) as e:
> +raise error.Abort(_('invalid path %s: %s') % (
> +path, pycompat.bytestr(e)))

I don't know if the path is included in the exception message, but it's
probably safer to use `stringutil.forcebytestr(e)` to get around possible
UnicodeError.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5768: subrepo: bytes/str cleanups on Git support

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


  > - retdata = p.stdout.read().strip() +retdata = 
pycompat.fsencode(p.stdout.read().strip())
  
  Curious why subprocess output can be a unicode. Is it a sort of text-mode
  stream?

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH V4] extdiff: add --per-file and --confirm options

2019-01-31 Thread Yuya Nishihara
On Tue, 29 Jan 2019 23:45:46 -0800, Ludovic Chabant wrote:
> # HG changeset patch
> # User Ludovic Chabant 
> # Date 1548831555 28800
> #  Tue Jan 29 22:59:15 2019 -0800
> # Node ID 7127fdab8807f3a3bcf2b1eebb1ee4084233f21f
> # Parent  ef0e2f7224358c32b0f62b13e83e89ba2399c8cf
> extdiff: add --per-file and --confirm options

Queued this, thanks.

> diff --git a/hgext/extdiff.py b/hgext/extdiff.py
> --- a/hgext/extdiff.py
> +++ b/hgext/extdiff.py
> @@ -71,6 +71,7 @@
>  import re
>  import shutil
>  import stat
> +import subprocess

Unused in this version. Removed.

> -def __init__(self, path, cmdline):
> +def __init__(self, cmd, path, cmdline):
>  # We can't pass non-ASCII through docstrings (and path is
>  # in an unknown encoding anyway), but avoid double separators on
>  # Windows
>  docpath = stringutil.escapestr(path).replace(b'', b'\\')
>  self.__doc__ %= {r'path': 
> pycompat.sysstr(stringutil.uirepr(docpath))}
>  self._cmdline = cmdline
> +self._cmd = cmd
>  
>  def __call__(self, ui, repo, *pats, **opts):
>  opts = pycompat.byteskwargs(opts)
> @@ -440,7 +528,7 @@
>  cmdline += ' ' + args
>  command(cmd, extdiffopts[:], _('hg %s [OPTION]... [FILE]...') % cmd,
>  helpcategory=command.CATEGORY_FILE_CONTENTS,
> -inferrepo=True)(savedcmd(path, cmdline))
> +inferrepo=True)(savedcmd(cmd, path, cmdline))

Looks like unrelated change. Also removed.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] run-tests: sort the skip, failure and error lists in the final output

2019-01-31 Thread Yuya Nishihara
On Wed, 30 Jan 2019 21:05:45 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison 
> # Date 1548894031 18000
> #  Wed Jan 30 19:20:31 2019 -0500
> # Node ID 5380290f1f11face5e58428cdb389eb7245969ba
> # Parent  4a2c8ec90a28542cbccc155fc6ddf60fe0a8d1dc
> run-tests: sort the skip, failure and error lists in the final output

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


Re: [PATCH V3] extdiff: add --per-file and --confirm options

2019-01-31 Thread Yuya Nishihara
On Wed, 30 Jan 2019 08:57:07 -0800, Ludovic Chabant wrote:
> > My point was that it could be addressed by checking the gui flag (or adding
> > new dedicated flag to [diff/merge-tools].) It's a tool property whether
> > multiple processes can be spawned or not.
> 
> After testing a bit, it turns out it's actually a bit more complicated than I 
> anticipated. Consider this:
> 
> [extdiff]
> blah =
> 
> [diff-tools]
> blah.gui = True
> 
> [merge-tools]
> blah.diffargs = -a -b -c
> 
> The extdiff command will find the options to use on the command line from the 
> [merge-tools] sections. Does this mean we ignore the "gui = True" from 
> [diff-tools] even though that's clearly intended for *diff commands to use?

I think diff-tools.blah.gui should be ignored in this case.

> It could also be the opposite, where the "diffargs" are found in [diff-tools] 
> and "gui" is set in [merge-tools].
> 
> And there's the case where no "diffargs" are provided anywhere, in which case 
> the "gui" setting might be taken from wherever we find, leading to the 
> problem where, if you have:
> 
> [extdiff]
> blah =
> 
> [merge-tools]
> blah.gui = True
> 
> ...then it will consider "blah" to be a GUI tool... until you add a 
> [diff-tools] section with "blah.diffargs" and suddenly "blah" isn't 
> considered a GUI anymore because the presence of a "diffargs" setting there 
> made us stop looking at the [merge-tools] section.
> 
> I think the best we can do might be to look for "gui" in [merge-tools] _only_ 
> if "diffargs" is also there, and otherwise _only_ look for "gui" in 
> [diff-tools]...  ideas?

My idea is basically as follows:

  if cmd and opts found in extdiff:
  # it must be a user-defined tool
  look for extdiff.gui.
  elif cmd.diffargs found in diff-tools:
  # perhaps it's a stock tool template defined in [diff-tools] (less common)
  look for diff-tools..gui
  elif cmd.diffargs found in merge-tools:
  # perhaps it's a stock tool template defined in [merge-tools] (common)
  look for merge-tools..gui

> Unless I'm missing something, I feels like we're basically reaching the 
> limits of the, ahem, rather organic spec of the extdiff command (there's not 
> even a help topic on "config.diff-tools"). After we solve this, I would be 
> totally ok working on some patches to make a core "hg difftool" command or 
> something, with a more strict UX.

Nice. I think the core version can also be "hg extdiff" that supports -t/--tool
option. And the extdiff extension will wrap the core extdiff command to support
-p/--program and command aliases for backward compatibility.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH STABLE] revlog: make sure we never use sparserevlog without general delta (issue6056)

2019-01-31 Thread Yuya Nishihara
On Tue, 29 Jan 2019 10:41:17 -0800, Gregory Szorc wrote:
> On Tue, Jan 29, 2019 at 3:44 AM Yuya Nishihara  wrote:
> > is a global requirement. I don't know if sparserevlog should be a revlog
> > flag
> > or not, but anyway only thing we can do here is to turn off the sparse, as
> > your
> > patch does.
> >
> 
> Sparse should have a revlog flag in addition to a repo requirement. My
> understanding is we already shipped sparse support in 4.8. This means we
> can't introduce a revlog flag (and corresponding repo requirement) without
> a BC change. I started a series to introduce revlog version 2 (mainly to
> support zstd compression in revlogs). We can do things more properly in
> revlog version 2. But I fear the lack of a sparse revlog flag will just
> have to be an historical wart since we've already shipped it.

Maybe we should document the wart in revlog.py so we won't make the same
kind of mistakes in future?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 2 STABLE V2 STABLE] sparserevlog: document the config option

2019-01-31 Thread Yuya Nishihara
On Wed, 30 Jan 2019 22:50:53 -0500, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1548868538 -3600
> #  Wed Jan 30 18:15:38 2019 +0100
> # Branch stable
> # Node ID cf5421ca2bea707ce52fc96f5ca68cf8f4894e8c
> # Parent  ab0d762d89ef6e2fdcf2a4cc31e9889ea04bc13b
> # EXP-Topic issue6056
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> cf5421ca2bea
> sparserevlog: document the config option

Fixed a couple of typos and queued for stable, thanks.

> +``sparse-revlog``

I also removed "# experimental config: format.sparse-revlog" from localrepo.py.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel