D3587: pathencode: fix importing hashlib on Python 3

2018-05-18 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG92ac9cf78dba: pathencode: fix importing hashlib on Python 3 
(authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3587?vs=8749=8758

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

AFFECTED FILES
  mercurial/cext/pathencode.c

CHANGE DETAILS

diff --git a/mercurial/cext/pathencode.c b/mercurial/cext/pathencode.c
--- a/mercurial/cext/pathencode.c
+++ b/mercurial/cext/pathencode.c
@@ -660,7 +660,7 @@
if (name == NULL)
return -1;
 
-   hashlib = PyImport_Import(name);
+   hashlib = PyImport_ImportModule("hashlib");
Py_DECREF(name);
 
if (hashlib == NULL) {



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


D3589: pathencode: improve error messages slightly

2018-05-18 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG9aaa74f9eb87: pathencode: improve error messages slightly 
(authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3589?vs=8751=8760

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

AFFECTED FILES
  mercurial/cext/pathencode.c

CHANGE DETAILS

diff --git a/mercurial/cext/pathencode.c b/mercurial/cext/pathencode.c
--- a/mercurial/cext/pathencode.c
+++ b/mercurial/cext/pathencode.c
@@ -664,16 +664,17 @@
Py_DECREF(name);
 
if (hashlib == NULL) {
-   PyErr_SetString(PyExc_ImportError, "hashlib");
+   PyErr_SetString(PyExc_ImportError,
+   "pathencode failed to find hashlib");
return -1;
}
shafunc = PyObject_GetAttrString(hashlib, "sha1");
Py_DECREF(hashlib);
 
if (shafunc == NULL) {
PyErr_SetString(PyExc_AttributeError,
"module 'hashlib' has no "
-   "attribute 'sha1'");
+   "attribute 'sha1' in pathencode");
return -1;
}
}



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


D3588: pathencode: hashlib.sha1() takes bytes not str on Python 3

2018-05-18 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4fccc73ce2f6: pathencode: hashlib.sha1() takes bytes not 
str on Python 3 (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3588?vs=8750=8759

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

AFFECTED FILES
  mercurial/cext/pathencode.c

CHANGE DETAILS

diff --git a/mercurial/cext/pathencode.c b/mercurial/cext/pathencode.c
--- a/mercurial/cext/pathencode.c
+++ b/mercurial/cext/pathencode.c
@@ -678,7 +678,7 @@
}
}
 
-   shaobj = PyObject_CallFunction(shafunc, "s#", str, len);
+   shaobj = PyObject_CallFunction(shafunc, PY23("s#", "y#"), str, len);
 
if (shaobj == NULL)
return -1;



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


D3585: context: fix %-formatting on Python 3

2018-05-18 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc0f8fa74d8c2: context: fix %-formatting on Python 3 
(authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3585?vs=8747=8757

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -432,7 +432,7 @@
 # lookup failed
 except (error.FilteredIndexError, error.FilteredLookupError):
 raise error.FilteredRepoLookupError(_("filtered revision '%s'")
-% changeid)
+% pycompat.bytestr(changeid))
 except error.FilteredRepoLookupError:
 raise
 except IndexError:



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


D3584: patch: fix import-time syntax error in test-check-module-imports.t

2018-05-18 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG468797392cc6: patch: fix import-time syntax error in 
test-check-module-imports.t (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3584?vs=8746=8756

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

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
@@ -51,7 +51,7 @@
 gitre = re.compile(br'diff --git a/(.*) b/(.*)')
 tabsplitter = re.compile(br'(\t+|[^\t]+)')
 wordsplitter = re.compile(br'(\t+| +|[a-zA-Z0-9_\x80-\xff]+|'
-  '[^ \ta-zA-Z0-9_\x80-\xff])')
+  b'[^ \ta-zA-Z0-9_\x80-\xff])')
 
 PatchError = error.PatchError
 



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


D3580: py3: use .startswith() instead of bytes[0]

2018-05-18 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb403e87df069: py3: use .startswith() instead of bytes[0] 
(authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3580?vs=8741=8752

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

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
@@ -2492,14 +2492,14 @@
 chompline = line.rstrip('\n')
 # highlight tabs and trailing whitespace
 stripline = chompline.rstrip()
-if line[0] == '-':
+if line.startswith('-'):
 label = 'diff.deleted'
-elif line[0] == '+':
+elif line.startswith('+'):
 label = 'diff.inserted'
 else:
 raise error.ProgrammingError('unexpected hunk line: %s' % line)
 for token in tabsplitter.findall(stripline):
-if '\t' == token[0]:
+if token.startswith('\t'):
 yield (token, 'diff.tab')
 else:
 yield (token, label)



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


D3583: py3: whitelist two more passing tests observed by buildbot

2018-05-18 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGcab398cb9b49: py3: whitelist two more passing tests 
observed by buildbot (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3583?vs=8745=8755

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

AFFECTED FILES
  contrib/python3-whitelist

CHANGE DETAILS

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -411,6 +411,7 @@
 test-revlog-group-emptyiter.t
 test-revlog-mmapindex.t
 test-revlog-packentry.t
+test-revlog-raw.py
 test-revset-dirstate-parents.t
 test-revset-legacy-lookup.t
 test-revset-outgoing.t
@@ -474,6 +475,7 @@
 test-url.py
 test-username-newline.t
 test-verify.t
+test-walk.t
 test-walkrepo.py
 test-websub.t
 test-win32text.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


D3582: py3: use stringutil.pprint() to format a list to print

2018-05-18 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG558e5504a4f8: py3: use stringutil.pprint() to format a list 
to print (authored by pulkit, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D3582?vs=8743=8754#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3582?vs=8743=8754

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

AFFECTED FILES
  hgext/mq.py

CHANGE DETAILS

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -492,7 +492,8 @@
 n, name = entry
 yield statusentry(bin(n), name)
 elif l.strip():
-self.ui.warn(_('malformated mq status line: %s\n') % entry)
+self.ui.warn(_('malformated mq status line: %s\n') %
+ stringutil.pprint(entry))
 # else we ignore empty lines
 try:
 lines = self.opener.read(self.statuspath).splitlines()



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


D3581: py3: fix kwargs handling in qgurad in hgext/mq.py

2018-05-18 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG88c2d0e639b1: py3: fix kwargs handling in qgurad in 
hgext/mq.py (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3581?vs=8742=8753

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

AFFECTED FILES
  hgext/mq.py

CHANGE DETAILS

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -2872,7 +2872,7 @@
 patch = None
 args = list(args)
 if opts.get(r'list'):
-if args or opts.get('none'):
+if args or opts.get(r'none'):
 raise error.Abort(_('cannot mix -l/--list with options or '
'arguments'))
 for i in xrange(len(q.series)):
@@ -2886,7 +2886,7 @@
 patch = args.pop(0)
 if patch is None:
 raise error.Abort(_('no patch to work with'))
-if args or opts.get('none'):
+if args or opts.get(r'none'):
 idx = q.findseries(patch)
 if idx is None:
 raise error.Abort(_('no patch named %s') % patch)



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


D3587: pathencode: fix importing hashlib on Python 3

2018-05-18 Thread yuja (Yuya Nishihara)
yuja added a comment.


  Queued, thanks.
  
  > if (name == NULL)
  > return -1;
  > 
  > 
  > - hashlib = PyImport_Import(name); +hashlib = 
PyImport_ImportModule("hashlib"); Py_DECREF(name);
  
  Nit: `name` is no longer used.

REPOSITORY
  rHG Mercurial

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

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: D3586: patch: use slicing to check patch line prefixes

2018-05-18 Thread Yuya Nishihara
This appears to conflict with D3580.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3586: patch: use slicing to check patch line prefixes

2018-05-18 Thread yuja (Yuya Nishihara)
yuja added a comment.


  This appears to conflict with https://phab.mercurial-scm.org/D3580.

REPOSITORY
  rHG Mercurial

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

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: D3587: pathencode: fix importing hashlib on Python 3

2018-05-18 Thread Yuya Nishihara
Queued, thanks.

>   if (name == NULL)
>   return -1;
>  
> - hashlib = PyImport_Import(name);
> + hashlib = PyImport_ImportModule("hashlib");
>   Py_DECREF(name);

Nit: `name` is no longer used.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3589: pathencode: improve error messages slightly

2018-05-18 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Both of these are conditions we should never hit, so we can afford to
  be more verbose to make debugging less baffling.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cext/pathencode.c

CHANGE DETAILS

diff --git a/mercurial/cext/pathencode.c b/mercurial/cext/pathencode.c
--- a/mercurial/cext/pathencode.c
+++ b/mercurial/cext/pathencode.c
@@ -664,16 +664,17 @@
Py_DECREF(name);
 
if (hashlib == NULL) {
-   PyErr_SetString(PyExc_ImportError, "hashlib");
+   PyErr_SetString(PyExc_ImportError,
+   "pathencode failed to find hashlib");
return -1;
}
shafunc = PyObject_GetAttrString(hashlib, "sha1");
Py_DECREF(hashlib);
 
if (shafunc == NULL) {
PyErr_SetString(PyExc_AttributeError,
"module 'hashlib' has no "
-   "attribute 'sha1'");
+   "attribute 'sha1' in pathencode");
return -1;
}
}



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


D3587: pathencode: fix importing hashlib on Python 3

2018-05-18 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I'm curious why PyImport_Import is returning NULL, but
  PyImport_ImportModule bypasses some of the regular import path,
  probably including demandimport, which I suspect is the issue here.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cext/pathencode.c

CHANGE DETAILS

diff --git a/mercurial/cext/pathencode.c b/mercurial/cext/pathencode.c
--- a/mercurial/cext/pathencode.c
+++ b/mercurial/cext/pathencode.c
@@ -660,7 +660,7 @@
if (name == NULL)
return -1;
 
-   hashlib = PyImport_Import(name);
+   hashlib = PyImport_ImportModule("hashlib");
Py_DECREF(name);
 
if (hashlib == NULL) {



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


D3588: pathencode: hashlib.sha1() takes bytes not str on Python 3

2018-05-18 Thread durin42 (Augie Fackler)
durin42 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/D3588

AFFECTED FILES
  mercurial/cext/pathencode.c

CHANGE DETAILS

diff --git a/mercurial/cext/pathencode.c b/mercurial/cext/pathencode.c
--- a/mercurial/cext/pathencode.c
+++ b/mercurial/cext/pathencode.c
@@ -678,7 +678,7 @@
}
}
 
-   shaobj = PyObject_CallFunction(shafunc, "s#", str, len);
+   shaobj = PyObject_CallFunction(shafunc, PY23("s#", "y#"), str, len);
 
if (shaobj == NULL)
return -1;



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


D3585: context: fix %-formatting on Python 3

2018-05-18 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  changeid could be an int or a bytestr, so use our pycompat wrapper.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -432,7 +432,7 @@
 # lookup failed
 except (error.FilteredIndexError, error.FilteredLookupError):
 raise error.FilteredRepoLookupError(_("filtered revision '%s'")
-% changeid)
+% pycompat.bytestr(changeid))
 except error.FilteredRepoLookupError:
 raise
 except IndexError:



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


D3586: patch: use slicing to check patch line prefixes

2018-05-18 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This fixes some regressed Python 3 tests, though I'm not sure when
  they regressed.

REPOSITORY
  rHG Mercurial

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

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
@@ -2492,9 +2492,9 @@
 chompline = line.rstrip('\n')
 # highlight tabs and trailing whitespace
 stripline = chompline.rstrip()
-if line[0] == '-':
+if line[0:1] == '-':
 label = 'diff.deleted'
-elif line[0] == '+':
+elif line[0:1] == '+':
 label = 'diff.inserted'
 else:
 raise error.ProgrammingError('unexpected hunk line: %s' % line)
@@ -2515,9 +2515,9 @@
 a = ''
 b = ''
 for line in hunklines:
-if line[0] == '-':
+if line[0:1] == '-':
 a += line[1:]
-elif line[0] == '+':
+elif line[0:1] == '+':
 b += line[1:]
 else:
 raise error.ProgrammingError('unexpected hunk line: %s' % line)



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


D3584: patch: fix import-time syntax error in test-check-module-imports.t

2018-05-18 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is more correct, though we were getting lucky in practice with
  our rewriter saving us.
  
  1. skip-blame just a b prefix

REPOSITORY
  rHG Mercurial

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

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
@@ -51,7 +51,7 @@
 gitre = re.compile(br'diff --git a/(.*) b/(.*)')
 tabsplitter = re.compile(br'(\t+|[^\t]+)')
 wordsplitter = re.compile(br'(\t+| +|[a-zA-Z0-9_\x80-\xff]+|'
-  '[^ \ta-zA-Z0-9_\x80-\xff])')
+  b'[^ \ta-zA-Z0-9_\x80-\xff])')
 
 PatchError = error.PatchError
 



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


D3583: py3: whitelist two more passing tests observed by buildbot

2018-05-18 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.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/python3-whitelist

CHANGE DETAILS

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -411,6 +411,7 @@
 test-revlog-group-emptyiter.t
 test-revlog-mmapindex.t
 test-revlog-packentry.t
+test-revlog-raw.py
 test-revset-dirstate-parents.t
 test-revset-legacy-lookup.t
 test-revset-outgoing.t
@@ -474,6 +475,7 @@
 test-url.py
 test-username-newline.t
 test-verify.t
+test-walk.t
 test-walkrepo.py
 test-websub.t
 test-win32text.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


D3559: narrow: only wrap dirstate functions once, instead of per-reposetup

2018-05-18 Thread spectral (Kyle Lippincott)
spectral updated this revision to Diff 8744.
spectral edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3559?vs=8682=8744

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

AFFECTED FILES
  hgext/narrow/__init__.py
  hgext/narrow/narrowdirstate.py
  hgext/narrow/narrowrepo.py
  mercurial/localrepo.py
  tests/test-narrow-expanddirstate.t

CHANGE DETAILS

diff --git a/tests/test-narrow-expanddirstate.t 
b/tests/test-narrow-expanddirstate.t
--- a/tests/test-narrow-expanddirstate.t
+++ b/tests/test-narrow-expanddirstate.t
@@ -72,29 +72,31 @@
   >   for f in repo[b'.'].manifest().walk(added):
   > repo.dirstate.normallookup(f)
   > 
-  > def makeds(ui, repo):
-  >   def wrapds(orig, self):
-  > ds = orig(self)
-  > class expandingdirstate(ds.__class__):
-  >   @hgutil.propertycache
-  >   def _map(self):
-  > ret = super(expandingdirstate, self)._map
-  > with repo.wlock(), repo.lock(), repo.transaction(
-  > b'expandnarrowspec'):
-  >   expandnarrowspec(ui, repo,
-  >encoding.environ.get(b'DIRSTATEINCLUDES'))
-  > return ret
-  > ds.__class__ = expandingdirstate
-  > return ds
-  >   return wrapds
+  > def wrapds(ui, repo, ds):
+  >   class expandingdirstate(ds.__class__):
+  > @hgutil.propertycache
+  > def _map(self):
+  >   ret = super(expandingdirstate, self)._map
+  >   with repo.wlock(), repo.lock(), repo.transaction(
+  >   b'expandnarrowspec'):
+  > expandnarrowspec(ui, repo,
+  >  encoding.environ.get(b'DIRSTATEINCLUDES'))
+  >   return ret
+  >   ds.__class__ = expandingdirstate
+  >   return ds
   > 
   > def reposetup(ui, repo):
-  >   extensions.wrapfilecache(localrepo.localrepository, b'dirstate',
-  >makeds(ui, repo))
-  >   def overridepatch(orig, *args, **kwargs):
+  >   class expandingrepo(repo.__class__):
+  > def _makedirstate(self):
+  >   dirstate = super(expandingrepo, self)._makedirstate()
+  >   return wrapds(ui, repo, dirstate)
+  >   repo.__class__ = expandingrepo
+  > 
+  > def extsetup(unused_ui):
+  >   def overridepatch(orig, ui, repo, *args, **kwargs):
   > with repo.wlock():
   >   expandnarrowspec(ui, repo, encoding.environ.get(b'PATCHINCLUDES'))
-  >   return orig(*args, **kwargs)
+  >   return orig(ui, repo, *args, **kwargs)
   > 
   >   extensions.wrapfunction(patch, b'patch', overridepatch)
   > EOF
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -778,6 +778,9 @@
 
 @repofilecache('dirstate')
 def dirstate(self):
+return self._makedirstate()
+
+def _makedirstate(self):
 sparsematchfn = lambda: sparse.matcher(self)
 
 return dirstate.dirstate(self.vfs, self.ui, self.root,
diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py
--- a/hgext/narrow/narrowrepo.py
+++ b/hgext/narrow/narrowrepo.py
@@ -15,6 +15,7 @@
 )
 
 from . import (
+narrowdirstate,
 narrowrevlog,
 )
 
@@ -62,4 +63,8 @@
 return scmutil.status(modified, added, removed, deleted, unknown,
   ignored, clean)
 
+def _makedirstate(self):
+dirstate = super(narrowrepository, self)._makedirstate()
+return narrowdirstate.wrapdirstate(self, dirstate)
+
 repo.__class__ = narrowrepository
diff --git a/hgext/narrow/narrowdirstate.py b/hgext/narrow/narrowdirstate.py
--- a/hgext/narrow/narrowdirstate.py
+++ b/hgext/narrow/narrowdirstate.py
@@ -9,74 +9,91 @@
 
 from mercurial.i18n import _
 from mercurial import (
-dirstate,
 error,
-extensions,
 match as matchmod,
 narrowspec,
 util as hgutil,
 )
 
-def setup(repo):
+def wrapdirstate(repo, dirstate):
 """Add narrow spec dirstate ignore, block changes outside narrow spec."""
 
-def walk(orig, self, match, subrepos, unknown, ignored, full=True,
- narrowonly=True):
-if narrowonly:
-# hack to not exclude explicitly-specified paths so that they can
-# be warned later on e.g. dirstate.add()
-em = matchmod.exact(match._root, match._cwd, match.files())
-nm = matchmod.unionmatcher([repo.narrowmatch(), em])
-match = matchmod.intersectmatchers(match, nm)
-return orig(self, match, subrepos, unknown, ignored, full)
-
-extensions.wrapfunction(dirstate.dirstate, 'walk', walk)
-
-# Prevent adding files that are outside the sparse checkout
-editfuncs = ['normal', 'add', 'normallookup', 'copy', 'remove', 'merge']
-for func in editfuncs:
-def _wrapper(orig, self, *args):
+def _editfunc(fn):
+def _wrapper(self, *args):
 dirstate = repo.dirstate
 narrowmatch = repo.narrowmatch()
 for f in args:
 

D3579: state: write the version number in plain text on top of state files

2018-05-18 Thread martinvonz (Martin von Zweigbergk)
martinvonz requested changes to this revision.
martinvonz added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> state.py:60-62
> +try:
> +iv = int(version)
> +except ValueError:

why not `if not isinstance(version, int):`?

REPOSITORY
  rHG Mercurial

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

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


D3582: py3: use stringutil.pprint() to format a list to print

2018-05-18 Thread pulkit (Pulkit Goyal)
pulkit 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/D3582

AFFECTED FILES
  hgext/mq.py

CHANGE DETAILS

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -492,7 +492,8 @@
 n, name = entry
 yield statusentry(bin(n), name)
 elif l.strip():
-self.ui.warn(_('malformated mq status line: %s\n') % entry)
+self.ui.warn(_('malformated mq status line: %s\n') %
+stringutil.pprint(entry))
 # else we ignore empty lines
 try:
 lines = self.opener.read(self.statuspath).splitlines()



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


D3581: py3: fix kwargs handling in qgurad in hgext/mq.py

2018-05-18 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  1. skip-blame because just r'' prefixes

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/mq.py

CHANGE DETAILS

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -2872,7 +2872,7 @@
 patch = None
 args = list(args)
 if opts.get(r'list'):
-if args or opts.get('none'):
+if args or opts.get(r'none'):
 raise error.Abort(_('cannot mix -l/--list with options or '
'arguments'))
 for i in xrange(len(q.series)):
@@ -2886,7 +2886,7 @@
 patch = args.pop(0)
 if patch is None:
 raise error.Abort(_('no patch to work with'))
-if args or opts.get('none'):
+if args or opts.get(r'none'):
 idx = q.findseries(patch)
 if idx is None:
 raise error.Abort(_('no patch named %s') % patch)



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


D3580: py3: use .startswith() instead of bytes[0]

2018-05-18 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  bytes[0] returns the ascii value of character at 0 index.

REPOSITORY
  rHG Mercurial

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

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
@@ -2492,14 +2492,14 @@
 chompline = line.rstrip('\n')
 # highlight tabs and trailing whitespace
 stripline = chompline.rstrip()
-if line[0] == '-':
+if line.startswith('-'):
 label = 'diff.deleted'
-elif line[0] == '+':
+elif line.startswith('+'):
 label = 'diff.inserted'
 else:
 raise error.ProgrammingError('unexpected hunk line: %s' % line)
 for token in tabsplitter.findall(stripline):
-if '\t' == token[0]:
+if token.startswith('\t'):
 yield (token, 'diff.tab')
 else:
 yield (token, label)



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


D3577: crecord: fallback to text mode if diffs are too big for curses mode

2018-05-18 Thread spectral (Kyle Lippincott)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGdabc2237963c: crecord: fallback to text mode if diffs are 
too big for curses mode (authored by spectral, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3577?vs=8731=8740

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/crecord.py

CHANGE DETAILS

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -65,6 +65,11 @@
 # compiled with curses
 curses = False
 
+class fallbackerror(error.Abort):
+"""Error that indicates the client should try to fallback to text mode."""
+# Inherits from error.Abort so that existing behavior is preserved if the
+# calling code does not know how to fallback.
+
 def checkcurses(ui):
 """Return True if the user wants to use curses
 
@@ -529,8 +534,8 @@
 origsigtstp = signal.getsignal(signal.SIGTSTP)
 try:
 curses.wrapper(chunkselector.main)
-if chunkselector.initerr is not None:
-raise error.Abort(chunkselector.initerr)
+if chunkselector.initexc is not None:
+raise chunkselector.initexc
 # ncurses does not restore signal handler for SIGTSTP
 finally:
 if origsigtstp is not sentinel:
@@ -1718,7 +1723,7 @@
 self.stdscr = stdscr
 # error during initialization, cannot be printed in the curses
 # interface, it should be printed by the calling code
-self.initerr = None
+self.initexc = None
 self.yscreensize, self.xscreensize = self.stdscr.getmaxyx()
 
 curses.start_color()
@@ -1751,7 +1756,8 @@
 try:
 self.chunkpad = curses.newpad(self.numpadlines, self.xscreensize)
 except curses.error:
-self.initerr = _('this diff is too large to be displayed')
+self.initexc = fallbackerror(
+_('this diff is too large to be displayed'))
 return
 # initialize selecteditemendline (initial start-line is 0)
 self.selecteditemendline = self.getnumlinesdisplayed(
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -197,17 +197,21 @@
 return oldwrite
 
 def filterchunks(ui, originalhunks, usecurses, testfile, operation=None):
-if usecurses:
-if testfile:
-recordfn = crecordmod.testdecorator(testfile,
-crecordmod.testchunkselector)
-else:
-recordfn = crecordmod.chunkselector
-
-return crecordmod.filterpatch(ui, originalhunks, recordfn, operation)
-
-else:
-return patch.filterpatch(ui, originalhunks, operation)
+try:
+if usecurses:
+if testfile:
+recordfn = crecordmod.testdecorator(
+testfile, crecordmod.testchunkselector)
+else:
+recordfn = crecordmod.chunkselector
+
+return crecordmod.filterpatch(ui, originalhunks, recordfn,
+  operation)
+except crecordmod.fallbackerror as e:
+ui.warn('%s\n' % e.message)
+ui.warn(_('falling back to text mode\n'))
+
+return patch.filterpatch(ui, originalhunks, operation)
 
 def recordfilter(ui, originalhunks, operation=None):
 """ Prompts the user to filter the originalhunks and return a list of



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


Re: [PATCH 6 of 6] lfs: enable the final download count status message

2018-05-18 Thread Pulkit Goyal
On Thu, May 17, 2018 at 4:48 AM Matt Harbison  wrote:

> On Fri, 20 Apr 2018 11:01:30 -0400, Pulkit Goyal <7895pul...@gmail.com>
> wrote:
>
> > On Sun, Apr 15, 2018 at 12:14 PM, Matt Harbison 
> > wrote:
> >
> >> # HG changeset patch
> >> # User Matt Harbison 
> >> # Date 1523754995 14400
> >> #  Sat Apr 14 21:16:35 2018 -0400
> >> # Node ID acd5a25c179269df689b8799aa7cbc52d5451251
> >> # Parent  a3702d55eb1ca64fc220827482e9d3a17cbfbb57
> >> lfs: enable the final download count status message
> >>
> >> At this point, I think all of the core commands are prefetching.
> >>
> >
> > ​It's great that you working so hard on it. Do you think lfs is in a
> > stage we can advertise in releasenotes of upcoming release?​
>
> It looks like LFS wasn't called out with the other experimental
> extensions.  Was the TODO list too scary to announce it yet?
>

​Hehe, I didn't know much about things in that list and LFS and hence
didn't take the decision on whether to include or not.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[Bug 5891] New: Subrepo remapping doesn't appear to work

2018-05-18 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=5891

Bug ID: 5891
   Summary: Subrepo remapping doesn't appear to work
   Product: Mercurial
   Version: 4.6
  Hardware: All
OS: All
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: matt_harbi...@yahoo.com
CC: mercurial-devel@mercurial-scm.org

It looks like the only test coverage is to call `hg debugsub` in
test-subrepo-paths.t, which doesn't actually instantiate the subrepo in the
remapped location.  If the subrepo move below is commented out, the failures go
away, even though `hg debugsub` seems to show the source has been properly
remapped.

  $ hg init outer2
  $ cd outer2

  $ hg init sub
  $ touch sub/x.txt
  $ echo 'sub = sub' > .hgsub
  $ hg add .hgsub
  $ hg ci -ASm 'add subrepo'
  adding sub/x.txt
  committing subrepository sub
  $ touch foo.txt
  $ hg ci -Aqm 'foo'
  $ hg cat sub/x.txt -r 0

  $ hg debugsub
  path sub
   source   sub
   revision 6095723e3ce9e706158f4afba2f6cd5279d2940a

  $ mv sub $TESTTMP/sub
  $ cat > .hg/hgrc < [subpaths]
  > sub = $TESTTMP/sub
  > EOF

  $ hg cat sub/x.txt -r 0
  skipping missing subrepository: sub
  [1]

  $ hg debugsub
  path sub
   source   $TESTTMP/sub
   revision 6095723e3ce9e706158f4afba2f6cd5279d2940a

  $ hg verify -q
  subrepo 'sub' not found in revision 6353828cd40f

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


D3576: narrow: filter copies in core

2018-05-18 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGee7b6fa52d9d: narrow: filter copies in core (authored by 
martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3576?vs=8730=8739

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

AFFECTED FILES
  hgext/narrow/__init__.py
  hgext/narrow/narrowmerge.py
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -254,6 +254,11 @@
 repo.ui.debug("%s:\n   %s\n" % (header % 'local', "\n   ".join(u1)))
 if u2:
 repo.ui.debug("%s:\n   %s\n" % (header % 'other', "\n   ".join(u2)))
+
+narrowmatch = repo.narrowmatch()
+if not narrowmatch.always():
+u1 = [f for f in u1 if narrowmatch(f)]
+u2 = [f for f in u2 if narrowmatch(f)]
 return u1, u2
 
 def _makegetfctx(ctx):
diff --git a/hgext/narrow/narrowmerge.py b/hgext/narrow/narrowmerge.py
deleted file mode 100644
--- a/hgext/narrow/narrowmerge.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# narrowmerge.py - extensions to mercurial merge module to support narrow 
clones
-#
-# Copyright 2017 Google, Inc.
-#
-# This software may be used and distributed according to the terms of the
-# GNU General Public License version 2 or any later version.
-
-from __future__ import absolute_import
-
-from mercurial import (
-copies,
-extensions,
-)
-
-def setup():
-def _computenonoverlap(orig, repo, *args, **kwargs):
-u1, u2 = orig(repo, *args, **kwargs)
-narrowmatch = repo.narrowmatch()
-if narrowmatch.always():
-return u1, u2
-
-u1 = [f for f in u1 if narrowmatch(f)]
-u2 = [f for f in u2 if narrowmatch(f)]
-return u1, u2
-extensions.wrapfunction(copies, '_computenonoverlap', _computenonoverlap)
diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py
--- a/hgext/narrow/__init__.py
+++ b/hgext/narrow/__init__.py
@@ -29,7 +29,6 @@
 narrowcommands,
 narrowcopies,
 narrowdirstate,
-narrowmerge,
 narrowpatch,
 narrowrepo,
 narrowrevlog,
@@ -64,7 +63,6 @@
 localrepo.featuresetupfuncs.add(featuresetup)
 narrowrevlog.setup()
 narrowbundle2.setup()
-narrowmerge.setup()
 narrowcommands.setup()
 narrowchangegroup.setup()
 narrowwirepeer.uisetup()



To: martinvonz, 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


D3574: narrow: filter merge actions in core

2018-05-18 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8f37b5fc5abf: narrow: filter merge actions in core 
(authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3574?vs=8728=8737

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

AFFECTED FILES
  hgext/narrow/narrowmerge.py
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1072,6 +1072,33 @@
 repo.ui.warn(_("%s: is both a file and a directory\n") % p)
 raise error.Abort(_("destination manifest contains path conflicts"))
 
+def _filternarrowactions(narrowmatch, branchmerge, actions):
+"""
+Filters out actions that can ignored because the repo is narrowed.
+
+Raise an exception if the merge cannot be completed because the repo is
+narrowed.
+"""
+nooptypes = set(['k']) # TODO: handle with nonconflicttypes
+nonconflicttypes = set('a am c cm f g r e'.split())
+# We mutate the items in the dict during iteration, so iterate
+# over a copy.
+for f, action in list(actions.items()):
+if narrowmatch(f):
+pass
+elif not branchmerge:
+del actions[f] # just updating, ignore changes outside clone
+elif action[0] in nooptypes:
+del actions[f] # merge does not affect file
+elif action[0] in nonconflicttypes:
+raise error.Abort(_('merge affects file \'%s\' outside narrow, '
+'which is not yet supported') % f,
+  hint=_('merging in the other direction '
+ 'may work'))
+else:
+raise error.Abort(_('conflict in file \'%s\' is outside '
+'narrow clone') % f)
+
 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, matcher,
   acceptremote, followcopies, forcefulldiff=False):
 """
@@ -1256,6 +1283,11 @@
 # If we are merging, look for path conflicts.
 checkpathconflicts(repo, wctx, p2, actions)
 
+narrowmatch = repo.narrowmatch()
+if not narrowmatch.always():
+# Updates "actions" in place
+_filternarrowactions(narrowmatch, branchmerge, actions)
+
 return actions, diverge, renamedelete
 
 def _resolvetrivial(repo, wctx, mctx, ancestor, actions):
diff --git a/hgext/narrow/narrowmerge.py b/hgext/narrow/narrowmerge.py
--- a/hgext/narrow/narrowmerge.py
+++ b/hgext/narrow/narrowmerge.py
@@ -7,48 +7,13 @@
 
 from __future__ import absolute_import
 
-from mercurial.i18n import _
 from mercurial import (
 copies,
-error,
 extensions,
 merge,
 )
 
 def setup():
-def _manifestmerge(orig, repo, wctx, p2, pa, branchmerge, *args, **kwargs):
-"""Filter updates to only lay out files that match the narrow spec."""
-actions, diverge, renamedelete = orig(
-repo, wctx, p2, pa, branchmerge, *args, **kwargs)
-
-narrowmatch = repo.narrowmatch()
-if narrowmatch.always():
-return actions, diverge, renamedelete
-
-nooptypes = set(['k']) # TODO: handle with nonconflicttypes
-nonconflicttypes = set('a am c cm f g r e'.split())
-# We mutate the items in the dict during iteration, so iterate
-# over a copy.
-for f, action in list(actions.items()):
-if narrowmatch(f):
-pass
-elif not branchmerge:
-del actions[f] # just updating, ignore changes outside clone
-elif action[0] in nooptypes:
-del actions[f] # merge does not affect file
-elif action[0] in nonconflicttypes:
-raise error.Abort(_('merge affects file \'%s\' outside narrow, 
'
-'which is not yet supported') % f,
-  hint=_('merging in the other direction '
- 'may work'))
-else:
-raise error.Abort(_('conflict in file \'%s\' is outside '
-'narrow clone') % f)
-
-return actions, diverge, renamedelete
-
-extensions.wrapfunction(merge, 'manifestmerge', _manifestmerge)
-
 def _checkcollision(orig, repo, wmf, actions):
 narrowmatch = repo.narrowmatch()
 if not narrowmatch.always():



To: martinvonz, 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


D3573: hgweb: extract code for emitting multiple changelist records

2018-05-18 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5989261a8356: hgweb: extract code for emitting multiple 
changelist records (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3573?vs=8727=8736

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

AFFECTED FILES
  mercurial/hgweb/webcommands.py
  mercurial/hgweb/webutil.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -457,6 +457,22 @@
 )
 return entry
 
+def changelistentries(web, revs, maxcount, parityfn):
+"""Emit up to N records for an iterable of revisions."""
+repo = web.repo
+
+count = 0
+for rev in revs:
+if count >= maxcount:
+break
+
+count += 1
+
+entry = changelistentry(web, repo[rev])
+entry['parity'] = next(parityfn)
+
+yield entry
+
 def symrevorshortnode(req, ctx):
 if 'node' in req.qsparams:
 return templatefilters.revescape(req.qsparams['node'])
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -398,14 +398,8 @@
 revs = []
 if pos != -1:
 revs = web.repo.changelog.revs(pos, 0)
-curcount = 0
-for rev in revs:
-curcount += 1
-if curcount > revcount + 1:
-break
 
-entry = webutil.changelistentry(web, web.repo[rev])
-entry['parity'] = next(parity)
+for entry in webutil.changelistentries(web, revs, revcount, parity):
 yield entry
 
 if shortlog:



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


D3575: narrow: filter set of files to check for case-folding to core

2018-05-18 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG18e6ea9ba81d: narrow: filter set of files to check for 
case-folding to core (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3575?vs=8729=8738

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

AFFECTED FILES
  hgext/narrow/narrowmerge.py
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -903,6 +903,23 @@
 return actions
 
 def _checkcollision(repo, wmf, actions):
+"""
+Check for case-folding collisions.
+"""
+
+# If the repo is narrowed, filter out files outside the narrowspec.
+narrowmatch = repo.narrowmatch()
+if not narrowmatch.always():
+wmf = wmf.matches(narrowmatch)
+if actions:
+narrowactions = {}
+for m, actionsfortype in actions.iteritems():
+narrowactions[m] = []
+for (f, args, msg) in actionsfortype:
+if narrowmatch(f):
+narrowactions[m].append((f, args, msg))
+actions = narrowactions
+
 # build provisional merged manifest up
 pmmf = set(wmf)
 
diff --git a/hgext/narrow/narrowmerge.py b/hgext/narrow/narrowmerge.py
--- a/hgext/narrow/narrowmerge.py
+++ b/hgext/narrow/narrowmerge.py
@@ -10,26 +10,9 @@
 from mercurial import (
 copies,
 extensions,
-merge,
 )
 
 def setup():
-def _checkcollision(orig, repo, wmf, actions):
-narrowmatch = repo.narrowmatch()
-if not narrowmatch.always():
-wmf = wmf.matches(narrowmatch)
-if actions:
-narrowactions = {}
-for m, actionsfortype in actions.iteritems():
-narrowactions[m] = []
-for (f, args, msg) in actionsfortype:
-if narrowmatch(f):
-narrowactions[m].append((f, args, msg))
-actions = narrowactions
-return orig(repo, wmf, actions)
-
-extensions.wrapfunction(merge, '_checkcollision', _checkcollision)
-
 def _computenonoverlap(orig, repo, *args, **kwargs):
 u1, u2 = orig(repo, *args, **kwargs)
 narrowmatch = repo.narrowmatch()



To: martinvonz, 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


D2874: remotenames: synchronise remotenames after push also

2018-05-18 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  Irrespective of https://phab.mercurial-scm.org/D2873 and 
https://phab.mercurial-scm.org/D2875, this should be non-controversial and good 
to go.

REPOSITORY
  rHG Mercurial

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

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


D2874: remotenames: synchronise remotenames after push also

2018-05-18 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 8735.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2874?vs=7287=8735

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

AFFECTED FILES
  mercurial/exchange.py
  tests/test-logexchange.t

CHANGE DETAILS

diff --git a/tests/test-logexchange.t b/tests/test-logexchange.t
--- a/tests/test-logexchange.t
+++ b/tests/test-logexchange.t
@@ -339,3 +339,59 @@
  default/bar   6:87d6d6676308
  default/foo   3:62615734edd5
* foo   8:3e1487808078
+
+Testing the remotenames sychronization during `hg push`
+---
+
+  $ cd ../server/
+  $ hg bookmark foo
+  moving bookmark 'foo' forward from 62615734edd5
+
+After the push, default/foo should move to rev 8
+  $ cd ../client/
+  $ hg push
+  pushing to ssh://user@dummy/server
+  searching for changes
+  no changes found
+  [1]
+  $ hg log -Gr 'remotenames()'
+  @  changeset:   8:3e1487808078
+  :  branch:  wat
+  :  bookmark:foo
+  :  tag: tip
+  :  remote bookmark:  default/foo
+  :  hoisted name:  foo
+  :  remote branch:  $TESTTMP/server2/wat
+  :  remote branch:  default/wat
+  :  parent:  4:aa98ab95a928
+  :  user:test
+  :  date:Thu Jan 01 00:00:00 1970 +
+  :  summary: added bar
+  :
+  : o  changeset:   7:ec2426147f0e
+  : |  remote branch:  $TESTTMP/server2/default
+  : |  remote branch:  default/default
+  : |  user:test
+  : |  date:Thu Jan 01 00:00:00 1970 +
+  : |  summary: Added h
+  : |
+  : o  changeset:   6:87d6d6676308
+  :/   remote bookmark:  $TESTTMP/server2/bar
+  :remote bookmark:  default/bar
+  :hoisted name:  bar
+  :user:test
+  :date:Thu Jan 01 00:00:00 1970 +
+  :summary: Added g
+  :
+  o  changeset:   3:62615734edd5
+  |  remote bookmark:  $TESTTMP/server2/foo
+  ~  user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: Added d
+  
+  $ hg bookmarks
+ $TESTTMP/server2/bar 6:87d6d6676308
+ $TESTTMP/server2/foo 3:62615734edd5
+ default/bar   6:87d6d6676308
+ default/foo   8:3e1487808078
+   * foo   8:3e1487808078
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -534,6 +534,9 @@
 _pushobsolete(pushop)
 _pushbookmark(pushop)
 
+if repo.ui.configbool('experimental', 'remotenames'):
+logexchange.pullremotenames(repo, remote)
+
 return pushop
 
 # list of steps to perform discovery before push



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


[Bug 5890] New: name persistent branch same as bookmark

2018-05-18 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=5890

Bug ID: 5890
   Summary: name persistent branch same as bookmark
   Product: Mercurial
   Version: 4.5.3
  Hardware: PC
OS: Windows
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: alexraynepe...@gmail.com
CC: mercurial-devel@mercurial-scm.org

hg can name branch in working dir with any name. if name is same as some
bookmark, this will conflicts with one bookmark later.

steps to reproduce:
1) hg bookmark conflict_name
2) hg branch conflict_name
3) hg ci ...  
here we have branch with name same as bookmark conflict_name

imho: hg branch should warn about such situation, or reject naming

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


Re: [PATCH V2] phabricator: register config settings

2018-05-18 Thread Yuya Nishihara
On Thu, 17 May 2018 21:56:12 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison 
> # Date 1526525067 14400
> #  Wed May 16 22:44:27 2018 -0400
> # Node ID a2ed1f916bba51cb5d1fec26a97c9668810c6588
> # Parent  a4a5c3085ea92402224ea4c61fccff3adbc715ec
> phabricator: register config settings

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


D3572: state: don't have a dict like interface for cmdstate class

2018-05-18 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 8732.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3572?vs=8721=8732

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

AFFECTED FILES
  mercurial/state.py

CHANGE DETAILS

diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -46,31 +46,12 @@
 """
 self._repo = repo
 self.fname = fname
-if not opts:
-self.opts = {}
-else:
-self.opts = opts
-
-def __nonzero__(self):
-return self.exists()
-
-def __getitem__(self, key):
-return self.opts[key]
 
-def __setitem__(self, key, value):
-updates = {key: value}
-self.opts.update(updates)
+def read(self):
+"""read the existing state file and return a dict of data stored"""
+return self._read()
 
-def load(self):
-"""load the existing state file into the class object"""
-op = self._read()
-self.opts.update(op)
-
-def addopts(self, opts):
-"""add more key-value pairs to the data stored by the object"""
-self.opts.update(opts)
-
-def save(self):
+def save(self, data):
 """write all the state data stored to .hg/ file
 
 we use third-party library cbor to serialize data to write in the file.



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


D3579: state: write the version number in plain text on top of state files

2018-05-18 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We will soon be using CBOR format to write the data in state files. But we
  should not write the version number of the state files in CBOR format and we
  should rather write it in plain text because in future we can change the 
format
  of state files and we should be able to parse the version number of state file
  without requiring to understand a certain format.
  
  This will help us in making sure we have a good compatibility story with other
  versions of state files.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/state.py

CHANGE DETAILS

diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -22,6 +22,7 @@
 from .thirdparty import cbor
 
 from . import (
+error,
 util,
 )
 
@@ -51,18 +52,30 @@
 """read the existing state file and return a dict of data stored"""
 return self._read()
 
-def save(self, data):
+def save(self, version, data):
 """write all the state data stored to .hg/ file
 
 we use third-party library cbor to serialize data to write in the file.
 """
+try:
+iv = int(version)
+except ValueError:
+raise error.ProgrammingError("version of state file should be"
+ " an integer")
+
 with self._repo.vfs(self.fname, 'wb', atomictemp=True) as fp:
+fp.write('%d\n' % iv)
 cbor.dump(self.opts, fp, canonical=True)
 
 def _read(self):
 """reads the state file and returns a dictionary which contain
 data in the same format as it was before storing"""
 with self._repo.vfs(self.fname, 'rb') as fp:
+try:
+version = int(fp.readline())
+except ValueError:
+raise error.ProgrammingError("unknown version of state file"
+ " found")
 return cbor.load(fp)
 
 def delete(self):



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


[Bug 5889] New: Random IOError with hgweb since 4.6 upgrade

2018-05-18 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=5889

Bug ID: 5889
   Summary: Random IOError with hgweb since 4.6 upgrade
   Product: Mercurial
   Version: 4.6
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: hgweb
  Assignee: bugzi...@mercurial-scm.org
  Reporter: philippe.pep...@logilab.fr
CC: mercurial-devel@mercurial-scm.org

Hello,

We have random (= not always) IOError on our hgweb instance since the upgrade
from 4.5.3 to 4.6.

[Fri May 18 11:18:21.684502 2018] [wsgi:error] [pid 27213:tid 139898761737984]
[client 1.2.3.4:12830] IOError: failed to write data

This might related to this wsgi warning:

[Fri May 18 11:27:33.617198 2018] [wsgi:warn] [pid 31209:tid 139824486274816]
mod_wsgi (pid=31209): Callback registration for signal 15 ignored.
[Fri May 18 11:27:33.617412 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
File "/usr/lib/python2.7/dist-packages/mercurial/hgweb/hgwebdir_mod.py", line
351, in run_wsgi
[Fri May 18 11:27:33.617450 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
  for r in self._runwsgi(req, res):
[Fri May 18 11:27:33.617483 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
File "/usr/lib/python2.7/dist-packages/mercurial/hgweb/hgweb_mod.py", line 302,
in run_wsgi
[Fri May 18 11:27:33.617514 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
  for r in self._runwsgi(req, res, repo):
[Fri May 18 11:27:33.617542 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
File "/usr/lib/python2.7/dist-packages/mercurial/hgweb/hgweb_mod.py", line 422,
in _runwsgi
[Fri May 18 11:27:33.617571 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
  return getattr(webcommands, cmd)(rctx)
[Fri May 18 11:27:33.617611 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
File "/usr/lib/python2.7/dist-packages/mercurial/hgweb/webcommands.py", line
195, in file
[Fri May 18 11:27:33.617643 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
  return manifest(web)
[Fri May 18 11:27:33.617675 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
File "/usr/lib/python2.7/dist-packages/mercurial/hgweb/webcommands.py", line
524, in manifest
[Fri May 18 11:27:33.617707 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
  ctx = webutil.changectx(web.repo, web.req)
[Fri May 18 11:27:33.617739 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
File "/usr/lib/python2.7/dist-packages/mercurial/hgweb/webutil.py", line 334,
in changectx
[Fri May 18 11:27:33.617770 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
  return scmutil.revsymbol(repo, changeid)
[Fri May 18 11:27:33.617803 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
File "/usr/lib/python2.7/dist-packages/mercurial/scmutil.py", line 507, in
revsymbol
[Fri May 18 11:27:33.617835 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
  node = repo.names.singlenode(repo, symbol)
[Fri May 18 11:27:33.617861 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
File "/usr/lib/python2.7/dist-packages/mercurial/namespaces.py", line 105, in
singlenode
[Fri May 18 11:27:33.617890 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
  n = v.namemap(repo, name)
[Fri May 18 11:27:33.617916 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
File "/usr/lib/python2.7/dist-packages/mercurial/namespaces.py", line 44, in

[Fri May 18 11:27:33.617946 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
  tagnamemap = lambda repo, name: tolist(repo._tagscache.tags.get(name))
[Fri May 18 11:27:33.617972 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 1437, in
__get__
[Fri May 18 11:27:33.618008 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
  result = self.func(obj)
[Fri May 18 11:27:33.618036 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
File "/usr/lib/python2.7/dist-packages/mercurial/localrepo.py", line 943, in
_tagscache
[Fri May 18 11:27:33.618066 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
  cache.tags, cache.tagtypes = self._findtags()
[Fri May 18 11:27:33.618091 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
File "/usr/lib/python2.7/dist-packages/mercurial/localrepo.py", line 979, in
_findtags
[Fri May 18 11:27:33.618121 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
  alltags = tagsmod.findglobaltags(self.ui, self)
[Fri May 18 11:27:33.618147 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
File "/usr/lib/python2.7/dist-packages/mercurial/tags.py", line 180, in
findglobaltags
[Fri May 18 11:27:33.618176 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
  (heads, tagfnode, valid, cachetags, shouldwrite) = _readtagcache(ui, repo)
[Fri May 18 11:27:33.618202 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
File "/usr/lib/python2.7/dist-packages/mercurial/tags.py", line 460, in
_readtagcache
[Fri May 18 11:27:33.618231 2018] [wsgi:warn] [pid 31209:tid 139824486274816]  
  cachefnode = 

Re: [PATCH 2 of 2] test-http-branchmap: fix stdio mode on Windows

2018-05-18 Thread Pulkit Goyal
On Sun, May 13, 2018 at 7:57 AM Yuya Nishihara  wrote:

> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1526177393 -32400
> #  Sun May 13 11:09:53 2018 +0900
> # Node ID 74982ab8ca762a3cfe3648740dae27555232476b
> # Parent  af07d426066dd8326c50a5686d7ecd25072d67b3
> test-http-branchmap: fix stdio mode on Windows
>

​Queued the series as per Matt's review. Many thanks!​
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3577: crecord: fallback to text mode if diffs are too big for curses mode

2018-05-18 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  crecord uses curses.newpad to create a region that we can then scroll around 
in
  by moving the main 'screen' as a veiwport into the (probably larger than the
  actual screen) pad.  Internally, at least in ncurses, pads are implemented 
using
  windows, which have their dimensions limited to a certain size.  Depending on
  compilation options for ncurses, this size might be pretty small: (signed)
  short, or it might be larger ((signed) int).
  
  crecord wants to have enough room to have all of the contents of the main area
  of the chunkselector in the pad; this means that the full size with everything
  expanded must be less than these (undocumented, afaict) limits.
  
  It's not easy to write tests for this because the limits are platform- and
  installation- dependent and undocumented / unqueryable, as far as I can tell.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/crecord.py

CHANGE DETAILS

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -65,6 +65,11 @@
 # compiled with curses
 curses = False
 
+class fallbackerror(error.Abort):
+"""Error that indicates the client should try to fallback to text mode."""
+# Inherits from error.Abort so that existing behavior is preserved if the
+# calling code does not know how to fallback.
+
 def checkcurses(ui):
 """Return True if the user wants to use curses
 
@@ -529,8 +534,8 @@
 origsigtstp = signal.getsignal(signal.SIGTSTP)
 try:
 curses.wrapper(chunkselector.main)
-if chunkselector.initerr is not None:
-raise error.Abort(chunkselector.initerr)
+if chunkselector.initexc is not None:
+raise chunkselector.initexc
 # ncurses does not restore signal handler for SIGTSTP
 finally:
 if origsigtstp is not sentinel:
@@ -1718,7 +1723,7 @@
 self.stdscr = stdscr
 # error during initialization, cannot be printed in the curses
 # interface, it should be printed by the calling code
-self.initerr = None
+self.initexc = None
 self.yscreensize, self.xscreensize = self.stdscr.getmaxyx()
 
 curses.start_color()
@@ -1751,7 +1756,8 @@
 try:
 self.chunkpad = curses.newpad(self.numpadlines, self.xscreensize)
 except curses.error:
-self.initerr = _('this diff is too large to be displayed')
+self.initexc = fallbackerror(
+_('this diff is too large to be displayed'))
 return
 # initialize selecteditemendline (initial start-line is 0)
 self.selecteditemendline = self.getnumlinesdisplayed(
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -197,17 +197,21 @@
 return oldwrite
 
 def filterchunks(ui, originalhunks, usecurses, testfile, operation=None):
-if usecurses:
-if testfile:
-recordfn = crecordmod.testdecorator(testfile,
-crecordmod.testchunkselector)
-else:
-recordfn = crecordmod.chunkselector
-
-return crecordmod.filterpatch(ui, originalhunks, recordfn, operation)
-
-else:
-return patch.filterpatch(ui, originalhunks, operation)
+try:
+if usecurses:
+if testfile:
+recordfn = crecordmod.testdecorator(
+testfile, crecordmod.testchunkselector)
+else:
+recordfn = crecordmod.chunkselector
+
+return crecordmod.filterpatch(ui, originalhunks, recordfn,
+  operation)
+except crecordmod.fallbackerror as e:
+ui.warn('%s\n' % e.message)
+ui.warn(_('falling back to text mode\n'))
+
+return patch.filterpatch(ui, originalhunks, operation)
 
 def recordfilter(ui, originalhunks, operation=None):
 """ Prompts the user to filter the originalhunks and return a list of



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