mercurial@43141: 11 new changesets

2019-10-09 Thread Mercurial Commits
11 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/c17a63eb5d4c
changeset:   43131:c17a63eb5d4c
user:Pierre-Yves David 
date:Sun Oct 06 23:36:51 2019 -0400
summary: sidedata: apply basic but tight security around exchange

https://www.mercurial-scm.org/repo/hg/rev/8f807a83d53b
changeset:   43132:8f807a83d53b
user:Pierre-Yves David 
date:Sun Oct 06 23:36:51 2019 -0400
summary: sidedata: use only changegroup3 if sidedata is in use

https://www.mercurial-scm.org/repo/hg/rev/3de4d13f22be
changeset:   43133:3de4d13f22be
user:Pierre-Yves David 
date:Sun Oct 06 23:36:51 2019 -0400
summary: revlog: add a way to control sidedata changes during revlog.clone

https://www.mercurial-scm.org/repo/hg/rev/75ad8af9c95e
changeset:   43134:75ad8af9c95e
user:Pierre-Yves David 
date:Sun Oct 06 23:36:51 2019 -0400
summary: upgrade: allow upgrade to repository using sidedata

https://www.mercurial-scm.org/repo/hg/rev/6e3dc1eff5c7
changeset:   43135:6e3dc1eff5c7
user:Pierre-Yves David 
date:Sun Oct 06 23:36:51 2019 -0400
summary: upgrade: allow for `sidedata` removal

https://www.mercurial-scm.org/repo/hg/rev/ba5b062a1388
changeset:   43136:ba5b062a1388
user:Pierre-Yves David 
date:Sun Oct 06 23:36:51 2019 -0400
summary: debugsidedata: small doc improvement

https://www.mercurial-scm.org/repo/hg/rev/81efc4a295e7
changeset:   43137:81efc4a295e7
user:Pierre-Yves David 
date:Sun Oct 06 23:36:51 2019 -0400
summary: sidedatacopies: add a new requirement for storing copies into 
sidedata

https://www.mercurial-scm.org/repo/hg/rev/f9dc98a97cdb
changeset:   43138:f9dc98a97cdb
user:Pierre-Yves David 
date:Sun Oct 06 23:36:51 2019 -0400
summary: sidedatacopies: teach upgrade about the new requirement

https://www.mercurial-scm.org/repo/hg/rev/f78ad4caa5ad
changeset:   43139:f78ad4caa5ad
user:Pierre-Yves David 
date:Sun Oct 06 23:36:51 2019 -0400
summary: sidedatacopies: introduce a sidedata testcase for test-copies.t

https://www.mercurial-scm.org/repo/hg/rev/12b8a2ef8d04
changeset:   43140:12b8a2ef8d04
user:Pierre-Yves David 
date:Sun Oct 06 23:36:51 2019 -0400
summary: sidedatacopies: introduce a sidedata testcase for 
test-copies-unrelated.t

https://www.mercurial-scm.org/repo/hg/rev/52781d57313d
changeset:   43141:52781d57313d
bookmark:@
tag: tip
user:Pierre-Yves David 
date:Sun Oct 06 23:36:51 2019 -0400
summary: sidedatacopies: introduce a sidedata testcase for 
test-copies-in-changeset.t

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


D7038: py3: add a missing b'' prefix in test extension for chg

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHGcd512f2e076d: py3: add a missing b prefix in 
test extension for chg (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7038?vs=17030=17036

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7038/new/

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

AFFECTED FILES
  tests/test-chg.t

CHANGE DETAILS

diff --git a/tests/test-chg.t b/tests/test-chg.t
--- a/tests/test-chg.t
+++ b/tests/test-chg.t
@@ -127,7 +127,7 @@
   > command = registrar.command(cmdtable)
   > @command(b'crash')
   > def pagercrash(ui, repo, *pats, **opts):
-  > ui.write('going to crash\n')
+  > ui.write(b'going to crash\n')
   > raise Exception('.')
   > EOF
 



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


D7034: fuzz: new target to fuzz jsonescapeu8fast

2019-10-09 Thread durin42 (Augie Fackler)
Closed by commit rHG2b11fe679a5d: fuzz: new target to fuzz jsonescapeu8fast 
(authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7034?vs=16991=17035

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7034/new/

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

AFFECTED FILES
  contrib/fuzz/Makefile
  contrib/fuzz/jsonescapeu8fast.cc

CHANGE DETAILS

diff --git a/contrib/fuzz/jsonescapeu8fast.cc b/contrib/fuzz/jsonescapeu8fast.cc
new file mode 100644
--- /dev/null
+++ b/contrib/fuzz/jsonescapeu8fast.cc
@@ -0,0 +1,57 @@
+#include 
+#include 
+#include 
+#include 
+
+#include "pyutil.h"
+
+#include 
+#include 
+#include 
+
+extern "C" {
+
+static PyCodeObject *code;
+
+extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
+{
+contrib::initpy(*argv[0]);
+code = (PyCodeObject *)Py_CompileString(R"py(
+from parsers import jsonescapeu8fast
+
+try:
+jsonescapeu8fast(data, paranoid)
+except Exception as e:
+pass
+# uncomment this print if you're editing this Python code
+# to debug failures.
+# print(e)
+)py",
+"fuzzer", Py_file_input);
+if (!code) {
+  std::cerr << "failed to compile Python code!" << std::endl;
+}
+return 0;
+}
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
+{
+FuzzedDataProvider provider(Data, Size);
+bool paranoid = provider.ConsumeBool();
+std::string remainder = provider.ConsumeRemainingBytesAsString();
+
+PyObject *mtext =
+  PyBytes_FromStringAndSize((const char *)remainder.c_str(), 
remainder.size());
+PyObject *locals = PyDict_New();
+PyDict_SetItemString(locals, "data", mtext);
+PyDict_SetItemString(locals, "paranoid", paranoid ? Py_True : 
Py_False);
+PyObject *res = PyEval_EvalCode(code, contrib::pyglobals(), locals);
+if (!res) {
+PyErr_Print();
+}
+Py_XDECREF(res);
+Py_DECREF(locals);
+Py_DECREF(mtext);
+return 0; // Non-zero return values are reserved for future use.
+}
+}
diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -121,6 +121,14 @@
  -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \
  -o $$OUT/fncache_fuzzer
 
+jsonescapeu8fast_fuzzer: jsonescapeu8fast.cc manifest.o charencode.o parsers.o 
dirs.o pathencode.o revlog.o pyutil.o
+   $(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+ -Wno-register -Wno-macro-redefined \
+ -I../../mercurial jsonescapeu8fast.cc \
+ manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o 
pyutil.o \
+ -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \
+ -o $$OUT/jsonescapeu8fast_fuzzer
+
 manifest_corpus.zip:
python manifest_corpus.py $$OUT/manifest_fuzzer_seed_corpus.zip
 
@@ -171,6 +179,6 @@
  mpatch \
  xdiff
 
-oss-fuzz: bdiff_fuzzer mpatch_fuzzer mpatch_corpus.zip xdiff_fuzzer 
dirs_fuzzer fncache_fuzzer manifest_fuzzer manifest_corpus.zip revlog_fuzzer 
revlog_corpus.zip dirstate_fuzzer dirstate_corpus.zip fm1readmarkers_fuzzer 
fm1readmarkers_corpus.zip
+oss-fuzz: bdiff_fuzzer mpatch_fuzzer mpatch_corpus.zip xdiff_fuzzer 
dirs_fuzzer fncache_fuzzer jsonescapeu8fast_fuzzer manifest_fuzzer 
manifest_corpus.zip revlog_fuzzer revlog_corpus.zip dirstate_fuzzer 
dirstate_corpus.zip fm1readmarkers_fuzzer fm1readmarkers_corpus.zip
 
 .PHONY: all clean oss-fuzz



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


D7033: fuzz: new fuzzer for fncache-related functions

2019-10-09 Thread durin42 (Augie Fackler)
Closed by commit rHGca2ca7fbad44: fuzz: new fuzzer for fncache-related 
functions (authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7033?vs=16990=17034

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7033/new/

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

AFFECTED FILES
  contrib/fuzz/Makefile
  contrib/fuzz/fncache.cc

CHANGE DETAILS

diff --git a/contrib/fuzz/fncache.cc b/contrib/fuzz/fncache.cc
new file mode 100644
--- /dev/null
+++ b/contrib/fuzz/fncache.cc
@@ -0,0 +1,78 @@
+#include 
+#include 
+#include 
+#include 
+
+#include "pyutil.h"
+
+#include 
+#include 
+
+extern "C" {
+
+static PyCodeObject *code;
+
+extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
+{
+contrib::initpy(*argv[0]);
+code = (PyCodeObject *)Py_CompileString(R"py(
+from parsers import (
+isasciistr,
+asciilower,
+asciiupper,
+encodedir,
+pathencode,
+lowerencode,
+)
+
+try:
+for fn in (
+isasciistr,
+asciilower,
+asciiupper,
+encodedir,
+pathencode,
+lowerencode,
+):
+try:
+fn(data)
+except UnicodeDecodeError:
+pass  # some functions emit this exception
+except AttributeError:
+# pathencode needs hashlib, which fails to import because the time
+# module fails to import. We should try and fix that some day, but
+# for now we at least get coverage on non-hashencoded codepaths.
+if fn != pathencode:
+raise
+# uncomment this for debugging exceptions
+# except Exception as e:
+# raise Exception('%r: %r' % (fn, e))
+except Exception as e:
+pass
+# uncomment this print if you're editing this Python code
+# to debug failures.
+# print(e)
+)py",
+"fuzzer", Py_file_input);
+if (!code) {
+  std::cerr << "failed to compile Python code!" << std::endl;
+}
+return 0;
+}
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
+{
+PyObject *mtext =
+PyBytes_FromStringAndSize((const char *)Data, (Py_ssize_t)Size);
+PyObject *locals = PyDict_New();
+PyDict_SetItemString(locals, "data", mtext);
+PyObject *res = PyEval_EvalCode(code, contrib::pyglobals(), locals);
+if (!res) {
+PyErr_Print();
+}
+Py_XDECREF(res);
+Py_DECREF(locals);
+Py_DECREF(mtext);
+return 0; // Non-zero return values are reserved for future use.
+}
+}
diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -113,6 +113,14 @@
  -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \
  -o $$OUT/dirs_fuzzer
 
+fncache_fuzzer: fncache.cc manifest.o charencode.o parsers.o dirs.o 
pathencode.o revlog.o pyutil.o
+   $(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+ -Wno-register -Wno-macro-redefined \
+ -I../../mercurial fncache.cc \
+ manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o 
pyutil.o \
+ -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \
+ -o $$OUT/fncache_fuzzer
+
 manifest_corpus.zip:
python manifest_corpus.py $$OUT/manifest_fuzzer_seed_corpus.zip
 
@@ -163,6 +171,6 @@
  mpatch \
  xdiff
 
-oss-fuzz: bdiff_fuzzer mpatch_fuzzer mpatch_corpus.zip xdiff_fuzzer 
dirs_fuzzer manifest_fuzzer manifest_corpus.zip revlog_fuzzer revlog_corpus.zip 
dirstate_fuzzer dirstate_corpus.zip fm1readmarkers_fuzzer 
fm1readmarkers_corpus.zip
+oss-fuzz: bdiff_fuzzer mpatch_fuzzer mpatch_corpus.zip xdiff_fuzzer 
dirs_fuzzer fncache_fuzzer manifest_fuzzer manifest_corpus.zip revlog_fuzzer 
revlog_corpus.zip dirstate_fuzzer dirstate_corpus.zip fm1readmarkers_fuzzer 
fm1readmarkers_corpus.zip
 
 .PHONY: all clean oss-fuzz



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


D7032: fuzz: exercise a little more revlog code

2019-10-09 Thread durin42 (Augie Fackler)
Closed by commit rHGdc827f5aba93: fuzz: exercise a little more revlog code 
(authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7032?vs=16988=17033

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7032/new/

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

AFFECTED FILES
  contrib/fuzz/revlog.cc

CHANGE DETAILS

diff --git a/contrib/fuzz/revlog.cc b/contrib/fuzz/revlog.cc
--- a/contrib/fuzz/revlog.cc
+++ b/contrib/fuzz/revlog.cc
@@ -20,17 +20,22 @@
 try:
 index, cache = parse_index2(data, inline)
 index.slicechunktodensity(list(range(len(index))), 0.5, 262144)
+index.stats()
+index.findsnapshots({}, 0)
+10 in index
 for rev in range(len(index)):
+index.reachableroots(0, [len(index)-1], [rev])
 node = index[rev][7]
 partial = index.shortest(node)
 index.partialmatch(node[:partial])
+index.deltachain(rev, None, True)
 except Exception as e:
 pass
 # uncomment this print if you're editing this Python code
 # to debug failures.
 # print e
 )py",
-   "fuzzer", Py_file_input);
+"fuzzer", Py_file_input);
return 0;
 }
 



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


D7031: fuzz: new fuzzer for dirs.c

2019-10-09 Thread durin42 (Augie Fackler)
Closed by commit rHGbd503fdb878c: fuzz: new fuzzer for dirs.c (authored by 
durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7031?vs=16987=17032

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7031/new/

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

AFFECTED FILES
  contrib/fuzz/Makefile
  contrib/fuzz/dirs.cc

CHANGE DETAILS

diff --git a/contrib/fuzz/dirs.cc b/contrib/fuzz/dirs.cc
new file mode 100644
--- /dev/null
+++ b/contrib/fuzz/dirs.cc
@@ -0,0 +1,56 @@
+#include 
+#include 
+#include 
+#include 
+
+#include "pyutil.h"
+
+#include 
+
+extern "C" {
+
+static PyCodeObject *code;
+
+extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
+{
+contrib::initpy(*argv[0]);
+code = (PyCodeObject *)Py_CompileString(R"py(
+from parsers import dirs
+try:
+  files = mdata.split('\n')
+  d = dirs(files)
+  list(d)
+  'a' in d
+  if files:
+files[0] in d
+except Exception as e:
+  pass
+  # uncomment this print if you're editing this Python code
+  # to debug failures.
+  # print e
+)py",
+"fuzzer", Py_file_input);
+return 0;
+}
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
+{
+// Don't allow fuzzer inputs larger than 100k, since we'll just bog
+// down and not accomplish much.
+if (Size > 10) {
+return 0;
+}
+PyObject *mtext =
+PyBytes_FromStringAndSize((const char *)Data, (Py_ssize_t)Size);
+PyObject *locals = PyDict_New();
+PyDict_SetItemString(locals, "mdata", mtext);
+PyObject *res = PyEval_EvalCode(code, contrib::pyglobals(), locals);
+if (!res) {
+PyErr_Print();
+}
+Py_XDECREF(res);
+Py_DECREF(locals);
+Py_DECREF(mtext);
+return 0; // Non-zero return values are reserved for future use.
+}
+}
diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -105,6 +105,17 @@
  -I../../mercurial \
  -c -o revlog.o ../../mercurial/cext/revlog.c
 
+dirs_fuzzer: dirs.cc manifest.o charencode.o parsers.o dirs.o pathencode.o 
revlog.o pyutil.o
+   $(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+ -Wno-register -Wno-macro-redefined \
+ -I../../mercurial dirs.cc \
+ manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o 
pyutil.o \
+ -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \
+ -o $$OUT/dirs_fuzzer
+
+manifest_corpus.zip:
+   python manifest_corpus.py $$OUT/manifest_fuzzer_seed_corpus.zip
+
 manifest_fuzzer: manifest.cc manifest.o charencode.o parsers.o dirs.o 
pathencode.o revlog.o pyutil.o
$(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
  -Wno-register -Wno-macro-redefined \
@@ -113,9 +124,6 @@
  -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \
  -o $$OUT/manifest_fuzzer
 
-manifest_corpus.zip:
-   python manifest_corpus.py $$OUT/manifest_fuzzer_seed_corpus.zip
-
 revlog_fuzzer: revlog.cc manifest.o charencode.o parsers.o dirs.o pathencode.o 
revlog.o pyutil.o
$(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
  -Wno-register -Wno-macro-redefined \
@@ -155,6 +163,6 @@
  mpatch \
  xdiff
 
-oss-fuzz: bdiff_fuzzer mpatch_fuzzer mpatch_corpus.zip xdiff_fuzzer 
manifest_fuzzer manifest_corpus.zip revlog_fuzzer revlog_corpus.zip 
dirstate_fuzzer dirstate_corpus.zip fm1readmarkers_fuzzer 
fm1readmarkers_corpus.zip
+oss-fuzz: bdiff_fuzzer mpatch_fuzzer mpatch_corpus.zip xdiff_fuzzer 
dirs_fuzzer manifest_fuzzer manifest_corpus.zip revlog_fuzzer revlog_corpus.zip 
dirstate_fuzzer dirstate_corpus.zip fm1readmarkers_fuzzer 
fm1readmarkers_corpus.zip
 
 .PHONY: all clean oss-fuzz



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


D7030: dirs: fix trivial over-read of input data

2019-10-09 Thread durin42 (Augie Fackler)
Closed by commit rHG2a0774e9d2a8: dirs: fix trivial over-read of input data 
(authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7030?vs=16986=17031

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7030/new/

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

AFFECTED FILES
  mercurial/cext/dirs.c

CHANGE DETAILS

diff --git a/mercurial/cext/dirs.c b/mercurial/cext/dirs.c
--- a/mercurial/cext/dirs.c
+++ b/mercurial/cext/dirs.c
@@ -68,26 +68,41 @@
while ((pos = _finddir(cpath, pos - 1)) != -1) {
PyObject *val;
 
-   /* It's likely that every prefix already has an entry
-  in our dict. Try to avoid allocating and
-  deallocating a string for each prefix we check. */
-   if (key != NULL)
-   ((PyBytesObject *)key)->ob_shash = -1;
-   else {
-   /* Force Python to not reuse a small shared string. */
-   key = PyBytes_FromStringAndSize(cpath,
-pos < 2 ? 2 : pos);
+   if (pos < 2) {
+   key = PyBytes_FromStringAndSize(cpath, pos);
if (key == NULL)
goto bail;
+   } else {
+   /* It's likely that every prefix already has an entry
+  in our dict. Try to avoid allocating and
+  deallocating a string for each prefix we check. */
+   if (key != NULL)
+   ((PyBytesObject *)key)->ob_shash = -1;
+   else {
+   /* We know pos >= 2, so we won't get a small
+* shared string. */
+   key = PyBytes_FromStringAndSize(cpath, pos);
+   if (key == NULL)
+   goto bail;
+   }
+   /* Py_SIZE(o) refers to the ob_size member of
+* the struct. Yes, assigning to what looks
+* like a function seems wrong. */
+   Py_SIZE(key) = pos;
+   ((PyBytesObject *)key)->ob_sval[pos] = '\0';
}
-   /* Py_SIZE(o) refers to the ob_size member of the struct. Yes,
-   * assigning to what looks like a function seems wrong. */
-   Py_SIZE(key) = pos;
-   ((PyBytesObject *)key)->ob_sval[pos] = '\0';
 
val = PyDict_GetItem(dirs, key);
if (val != NULL) {
PYLONG_VALUE(val) += 1;
+   if (pos < 2) {
+   /* This was a short string, so we
+* probably got a small shared string
+* we can't mutate on the next loop
+* iteration. Clear it.
+*/
+   Py_CLEAR(key);
+   }
break;
}
 



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


D7020: pycompat: implement a shlexquote that properly handles bytes

2019-10-09 Thread indygreg (Gregory Szorc)
indygreg added a comment.
indygreg abandoned this revision.


  Yuya's patch fixed the test failure and is a better solution.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7020/new/

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

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


D7038: py3: add a missing b'' prefix in test extension for chg

2019-10-09 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/D7038

AFFECTED FILES
  tests/test-chg.t

CHANGE DETAILS

diff --git a/tests/test-chg.t b/tests/test-chg.t
--- a/tests/test-chg.t
+++ b/tests/test-chg.t
@@ -127,7 +127,7 @@
   > command = registrar.command(cmdtable)
   > @command(b'crash')
   > def pagercrash(ui, repo, *pats, **opts):
-  > ui.write('going to crash\n')
+  > ui.write(b'going to crash\n')
   > raise Exception('.')
   > EOF
 



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


D6999: help: categorizing evolve and topic commands

2019-10-09 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio added a comment.
rdamazio abandoned this revision.


  This will be reviewed via heptapod instead

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6999/new/

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

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


D6885: relnotes: mention API change from https://phab.mercurial-scm.org/D6884

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In D6885#102923 , @marmoute 
wrote:
  
  > I am a bit confused about this diff, is this still required ?
  
  No, I thought it would be helpful to have all the release notes in one place, 
but I think the consensus was that we'll keep release notes in both 
relnotes/next and in commit messages and then just merge them when it's time 
for a release. I'll drop this patch.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6885/new/

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

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


D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHG0171483b082f: sidedatacopies: read rename information from 
sidedata (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6953?vs=17023=17027

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

AFFECTED FILES
  mercurial/changelog.py
  mercurial/context.py
  mercurial/copies.py
  tests/test-copies-unrelated.t
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -309,7 +309,6 @@
   x -> z
   $ hg debugpathcopies 0 2
   x -> z (filelog !)
-  x -> z (sidedata !)
 
 Copy file that exists on both sides of the merge, different content
   $ newrepo
@@ -338,12 +337,14 @@
  x
   $ hg debugp1copies -r 2
   x -> z (changeset !)
+  x -> z (sidedata !)
   $ hg debugp2copies -r 2
-  x -> z (no-changeset !)
+  x -> z (no-changeset no-sidedata !)
   $ hg debugpathcopies 1 2
   x -> z (changeset !)
+  x -> z (sidedata !)
   $ hg debugpathcopies 0 2
-  x -> z (no-changeset !)
+  x -> z (no-changeset no-sidedata !)
 
 Copy x->y on one side of merge and copy x->z on the other side. Pathcopies 
from one parent
 of the merge to the merge should include the copy from the other side.
@@ -403,7 +404,7 @@
   $ hg debugpathcopies 2 3
   y -> z
   $ hg debugpathcopies 1 3
-  y -> z (no-filelog no-sidedata !)
+  y -> z (no-filelog !)
 
 Create x and y, then rename x to z on one side of merge, and rename y to z and
 modify z on the other side. When storing copies in the changeset, we don't
@@ -448,18 +449,16 @@
   o  0 add x and y
  x y
   $ hg debugpathcopies 1 4
-  y -> z (no-filelog no-sidedata !)
+  y -> z (no-filelog !)
   $ hg debugpathcopies 2 4
-  x -> z (no-filelog no-sidedata !)
+  x -> z (no-filelog !)
   $ hg debugpathcopies 0 4
   x -> z (filelog !)
-  x -> z (sidedata !)
-  y -> z (compatibility !)
-  y -> z (changeset !)
+  y -> z (no-filelog !)
   $ hg debugpathcopies 1 5
-  y -> z (no-filelog no-sidedata !)
+  y -> z (no-filelog !)
   $ hg debugpathcopies 2 5
-  x -> z (no-filelog no-sidedata !)
+  x -> z (no-filelog !)
   $ hg debugpathcopies 0 5
   x -> z
 
diff --git a/tests/test-copies-unrelated.t b/tests/test-copies-unrelated.t
--- a/tests/test-copies-unrelated.t
+++ b/tests/test-copies-unrelated.t
@@ -179,8 +179,8 @@
   o  0 add x
  x
   $ hg debugpathcopies 0 5
-  x -> y (no-filelog no-sidedata !)
-#if no-filelog no-sidedata
+  x -> y (no-filelog !)
+#if no-filelog
   $ hg graft -r 2
   grafting 2:* "modify x again" (glob)
   merging y and x to y
@@ -347,8 +347,8 @@
   o  0 base
  a
   $ hg debugpathcopies 1 5
-  x -> y (no-filelog no-sidedata !)
-#if no-filelog no-sidedata
+  x -> y (no-filelog !)
+#if no-filelog
   $ hg graft -r 2
   grafting 2:* "modify x" (glob)
   merging y and x to y
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -188,6 +188,8 @@
 
 def usechangesetcentricalgo(repo):
 """Checks if we should use changeset-centric copy algorithms"""
+if repo.filecopiesmode == b'changeset-sidedata':
+return True
 readfrom = repo.ui.config(b'experimental', b'copies.read-from')
 changesetsource = (b'changeset-only', b'compatibility')
 return readfrom in changesetsource
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -533,55 +533,76 @@
 return sorted(modified)
 
 def filesadded(self):
-source = self._repo.ui.config(b'experimental', b'copies.read-from')
 filesadded = self._changeset.filesadded
-if source == b'changeset-only':
-if filesadded is None:
+compute_on_none = True
+if self._repo.filecopiesmode == b'changeset-sidedata':
+compute_on_none = False
+else:
+source = self._repo.ui.config(b'experimental', b'copies.read-from')
+if source == b'changeset-only':
+compute_on_none = False
+elif source != b'compatibility':
+# filelog mode, ignore any changelog content
+filesadded = None
+if filesadded is None:
+if compute_on_none:
+filesadded = scmutil.computechangesetfilesadded(self)
+else:
 filesadded = []
-elif source == b'compatibility':
-if filesadded is None:
-filesadded = scmutil.computechangesetfilesadded(self)
-else:
-filesadded = scmutil.computechangesetfilesadded(self)
 return filesadded
 
 def filesremoved(self):
-source = self._repo.ui.config(b'experimental', b'copies.read-from')
 filesremoved = self._changeset.filesremoved

D6954: sidedatacopies: move various copies related function to the copies modules

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHG54e943b28101: sidedatacopies: move various copies related 
function to the copies modules (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6954?vs=17024=17028

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6954/new/

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

AFFECTED FILES
  mercurial/changelog.py
  mercurial/context.py
  mercurial/copies.py
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -2219,23 +2219,3 @@
 mark,
 mark,
 )
-
-
-def computechangesetfilesadded(ctx):
-"""return the list of files added in a changeset
-"""
-added = []
-for f in ctx.files():
-if not any(f in p for p in ctx.parents()):
-added.append(f)
-return added
-
-
-def computechangesetfilesremoved(ctx):
-"""return the list of files removed in a changeset
-"""
-removed = []
-for f in ctx.files():
-if f not in ctx:
-removed.append(f)
-return removed
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -14,6 +14,7 @@
 from .i18n import _
 
 from . import (
+error,
 match as matchmod,
 node,
 pathutil,
@@ -855,6 +856,26 @@
 wctx[dst].markcopied(src)
 
 
+def computechangesetfilesadded(ctx):
+"""return the list of files added in a changeset
+"""
+added = []
+for f in ctx.files():
+if not any(f in p for p in ctx.parents()):
+added.append(f)
+return added
+
+
+def computechangesetfilesremoved(ctx):
+"""return the list of files removed in a changeset
+"""
+removed = []
+for f in ctx.files():
+if f not in ctx:
+removed.append(f)
+return removed
+
+
 def computechangesetcopies(ctx):
 """return the copies data for a changeset
 
@@ -879,3 +900,58 @@
 elif src in p2 and p2[src].filenode() == srcnode:
 p2copies[dst] = src
 return p1copies, p2copies
+
+
+def encodecopies(files, copies):
+items = []
+for i, dst in enumerate(files):
+if dst in copies:
+items.append(b'%d\0%s' % (i, copies[dst]))
+if len(items) != len(copies):
+raise error.ProgrammingError(
+b'some copy targets missing from file list'
+)
+return b"\n".join(items)
+
+
+def decodecopies(files, data):
+try:
+copies = {}
+if not data:
+return copies
+for l in data.split(b'\n'):
+strindex, src = l.split(b'\0')
+i = int(strindex)
+dst = files[i]
+copies[dst] = src
+return copies
+except (ValueError, IndexError):
+# Perhaps someone had chosen the same key name (e.g. "p1copies") and
+# used different syntax for the value.
+return None
+
+
+def encodefileindices(files, subset):
+subset = set(subset)
+indices = []
+for i, f in enumerate(files):
+if f in subset:
+indices.append(b'%d' % i)
+return b'\n'.join(indices)
+
+
+def decodefileindices(files, data):
+try:
+subset = []
+if not data:
+return subset
+for strindex in data.split(b'\n'):
+i = int(strindex)
+if i < 0 or i >= len(files):
+return None
+subset.append(files[i])
+return subset
+except (ValueError, IndexError):
+# Perhaps someone had chosen the same key name (e.g. "added") and
+# used different syntax for the value.
+return None
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -546,7 +546,7 @@
 filesadded = None
 if filesadded is None:
 if compute_on_none:
-filesadded = scmutil.computechangesetfilesadded(self)
+filesadded = copies.computechangesetfilesadded(self)
 else:
 filesadded = []
 return filesadded
@@ -565,7 +565,7 @@
 filesremoved = None
 if filesremoved is None:
 if compute_on_none:
-filesremoved = scmutil.computechangesetfilesremoved(self)
+filesremoved = copies.computechangesetfilesremoved(self)
 else:
 filesremoved = []
 return filesremoved
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -16,6 +16,7 @@
 from .thirdparty import attr
 
 from . import (
+copies,
 encoding,
 error,
 pycompat,
@@ -89,61 +90,6 @@
 return b"\0".join(items)
 
 
-def encodecopies(files, 

D6955: sidedatacopies: deal with upgrading and downgrading to that format

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHG843da18386d5: sidedatacopies: deal with upgrading and 
downgrading to that format (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6955?vs=17010=17029

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6955/new/

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

AFFECTED FILES
  mercurial/copies.py
  mercurial/upgrade.py
  tests/test-copies-in-changeset.t

CHANGE DETAILS

diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t
--- a/tests/test-copies-in-changeset.t
+++ b/tests/test-copies-in-changeset.t
@@ -450,4 +450,91 @@
   $ hg ci -Aqm 'add a'
   $ hg mv a b
   $ hg ci -m 'remove a' a
+
+#if sidedata
+
+Test upgrading/downgrading to sidedata storage
+==
+
+downgrading (keeping some sidedata)
+
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:  yesyes  no
+  copies-sdc:yesyes  no
+  plain-cl-delta:yesyes yes
+  compression:   zlib   zlibzlib
+  compression-level: default default default
+  $ hg debugsidedata -c -- 0
+  4 sidedata entries
+   entry-0010 size 0
+   entry-0011 size 0
+   entry-0012 size 1
+   entry-0013 size 0
+  $ hg debugsidedata -c -- 1
+  4 sidedata entries
+   entry-0010 size 0
+   entry-0011 size 0
+   entry-0012 size 0
+   entry-0013 size 1
+  $ hg debugsidedata -m -- 0
+  $ cat << EOF > .hg/hgrc
+  > [format]
+  > use-side-data = yes
+  > exp-use-copies-side-data-changeset = no
+  > EOF
+  $ hg debugupgraderepo --run --quiet --no-backup > /dev/null
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:  yesyes  no
+  copies-sdc: no no  no
+  plain-cl-delta:yesyes yes
+  compression:   zlib   zlibzlib
+  compression-level: default default default
+  $ hg debugsidedata -c -- 0
+  $ hg debugsidedata -c -- 1
+  $ hg debugsidedata -m -- 0
+
+upgrading
+
+  $ cat << EOF > .hg/hgrc
+  > [format]
+  > exp-use-copies-side-data-changeset = yes
+  > EOF
+  $ hg debugupgraderepo --run --quiet --no-backup > /dev/null
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:  yesyes  no
+  copies-sdc:yesyes  no
+  plain-cl-delta:yesyes yes
+  compression:   zlib   zlibzlib
+  compression-level: default default default
+  $ hg debugsidedata -c -- 0
+  4 sidedata entries
+   entry-0010 size 0
+   entry-0011 size 0
+   entry-0012 size 1
+   entry-0013 size 0
+  $ hg debugsidedata -c -- 1
+  4 sidedata entries
+   entry-0010 size 0
+   entry-0011 size 0
+   entry-0012 size 0
+   entry-0013 size 1
+  $ hg debugsidedata -m -- 0
+
+#endif
+
   $ cd ..
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -13,6 +13,7 @@
 from .pycompat import getattr
 from . import (
 changelog,
+copies,
 error,
 filelog,
 hg,
@@ -31,7 +32,6 @@
 RECLONES_REQUIREMENTS = {
 b'generaldelta',
 localrepo.SPARSEREVLOG_REQUIREMENT,
-localrepo.SIDEDATA_REQUIREMENT,
 }
 
 
@@ -77,6 +77,7 @@
 supported = {
 localrepo.SPARSEREVLOG_REQUIREMENT,
 localrepo.SIDEDATA_REQUIREMENT,
+localrepo.COPIESSDC_REQUIREMENT,
 }
 for name in compression.compengines:
 engine = compression.compengines[name]
@@ -103,6 +104,7 @@
 b'store',
 localrepo.SPARSEREVLOG_REQUIREMENT,
 localrepo.SIDEDATA_REQUIREMENT,
+localrepo.COPIESSDC_REQUIREMENT,
 }
 for name in compression.compengines:
 engine = compression.compengines[name]
@@ -129,6 +131,7 @@
 b'generaldelta',
 localrepo.SPARSEREVLOG_REQUIREMENT,
 localrepo.SIDEDATA_REQUIREMENT,
+localrepo.COPIESSDC_REQUIREMENT,
 }
 for name in compression.compengines:
 engine = compression.compengines[name]
@@ -698,6 +701,7 @@
 def getsidedatacompanion(srcrepo, dstrepo):
 sidedatacompanion = None
 removedreqs = srcrepo.requirements - dstrepo.requirements
+addedreqs = dstrepo.requirements - srcrepo.requirements
 if localrepo.SIDEDATA_REQUIREMENT in removedreqs:
 
 def sidedatacompanion(rl, rev):
@@ -706,6 +710,10 @@
 return True, 

D7037: context: make copies related function return None or a valid value

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHG4296cc3c4ae1: changelog: make copies related function 
return None or a valid value (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7037?vs=17022=17026

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7037/new/

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

AFFECTED FILES
  mercurial/changelog.py

CHANGE DETAILS

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -363,22 +363,30 @@
 @property
 def filesadded(self):
 rawindices = self.extra.get(b'filesadded')
-return rawindices and decodefileindices(self.files, rawindices)
+if rawindices is None:
+return None
+return decodefileindices(self.files, rawindices)
 
 @property
 def filesremoved(self):
 rawindices = self.extra.get(b'filesremoved')
-return rawindices and decodefileindices(self.files, rawindices)
+if rawindices is None:
+return None
+return decodefileindices(self.files, rawindices)
 
 @property
 def p1copies(self):
 rawcopies = self.extra.get(b'p1copies')
-return rawcopies and decodecopies(self.files, rawcopies)
+if rawcopies is None:
+return None
+return decodecopies(self.files, rawcopies)
 
 @property
 def p2copies(self):
 rawcopies = self.extra.get(b'p2copies')
-return rawcopies and decodecopies(self.files, rawcopies)
+if rawcopies is None:
+return None
+return decodecopies(self.files, rawcopies)
 
 @property
 def description(self):



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


D7036: test: fix zstd related output in pure tests

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHGea230325dc8c: test: fix zstd related output in pure tests 
(authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7036?vs=17021=17025

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7036/new/

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

AFFECTED FILES
  tests/test-upgrade-repo.t

CHANGE DETAILS

diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
--- a/tests/test-upgrade-repo.t
+++ b/tests/test-upgrade-repo.t
@@ -1420,14 +1420,15 @@
   sidedata:  yes no  no
   copies-sdc: no no  no
   plain-cl-delta:yesyes yes
-  compression:   zstd   zstdzlib
+  compression:   zstd   zstdzlib (zstd !)
+  compression:   zlib   zlibzlib (no-zstd !)
   compression-level: default default default
   $ cat .hg/requires
   dotencode
   exp-sidedata-flag
   fncache
   generaldelta
-  revlog-compression-zstd
+  revlog-compression-zstd (zstd !)
   revlogv1
   sparserevlog
   store
@@ -1448,13 +1449,14 @@
   sidedata:   no no  no
   copies-sdc: no no  no
   plain-cl-delta:yesyes yes
-  compression:   zstd   zstdzlib
+  compression:   zstd   zstdzlib (zstd !)
+  compression:   zlib   zlibzlib (no-zstd !)
   compression-level: default default default
   $ cat .hg/requires
   dotencode
   fncache
   generaldelta
-  revlog-compression-zstd
+  revlog-compression-zstd (zstd !)
   revlogv1
   sparserevlog
   store
@@ -1476,14 +1478,15 @@
   sidedata:  yesyes  no
   copies-sdc: no no  no
   plain-cl-delta:yesyes yes
-  compression:   zstd   zstdzlib
+  compression:   zstd   zstdzlib (zstd !)
+  compression:   zlib   zlibzlib (no-zstd !)
   compression-level: default default default
   $ cat .hg/requires
   dotencode
   exp-sidedata-flag
   fncache
   generaldelta
-  revlog-compression-zstd
+  revlog-compression-zstd (zstd !)
   revlogv1
   sparserevlog
   store



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


D6954: sidedatacopies: move various copies related function to the copies modules

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 17024.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6954?vs=17009=17024

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6954/new/

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

AFFECTED FILES
  mercurial/changelog.py
  mercurial/context.py
  mercurial/copies.py
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -2219,23 +2219,3 @@
 mark,
 mark,
 )
-
-
-def computechangesetfilesadded(ctx):
-"""return the list of files added in a changeset
-"""
-added = []
-for f in ctx.files():
-if not any(f in p for p in ctx.parents()):
-added.append(f)
-return added
-
-
-def computechangesetfilesremoved(ctx):
-"""return the list of files removed in a changeset
-"""
-removed = []
-for f in ctx.files():
-if f not in ctx:
-removed.append(f)
-return removed
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -14,6 +14,7 @@
 from .i18n import _
 
 from . import (
+error,
 match as matchmod,
 node,
 pathutil,
@@ -855,6 +856,26 @@
 wctx[dst].markcopied(src)
 
 
+def computechangesetfilesadded(ctx):
+"""return the list of files added in a changeset
+"""
+added = []
+for f in ctx.files():
+if not any(f in p for p in ctx.parents()):
+added.append(f)
+return added
+
+
+def computechangesetfilesremoved(ctx):
+"""return the list of files removed in a changeset
+"""
+removed = []
+for f in ctx.files():
+if f not in ctx:
+removed.append(f)
+return removed
+
+
 def computechangesetcopies(ctx):
 """return the copies data for a changeset
 
@@ -879,3 +900,58 @@
 elif src in p2 and p2[src].filenode() == srcnode:
 p2copies[dst] = src
 return p1copies, p2copies
+
+
+def encodecopies(files, copies):
+items = []
+for i, dst in enumerate(files):
+if dst in copies:
+items.append(b'%d\0%s' % (i, copies[dst]))
+if len(items) != len(copies):
+raise error.ProgrammingError(
+b'some copy targets missing from file list'
+)
+return b"\n".join(items)
+
+
+def decodecopies(files, data):
+try:
+copies = {}
+if not data:
+return copies
+for l in data.split(b'\n'):
+strindex, src = l.split(b'\0')
+i = int(strindex)
+dst = files[i]
+copies[dst] = src
+return copies
+except (ValueError, IndexError):
+# Perhaps someone had chosen the same key name (e.g. "p1copies") and
+# used different syntax for the value.
+return None
+
+
+def encodefileindices(files, subset):
+subset = set(subset)
+indices = []
+for i, f in enumerate(files):
+if f in subset:
+indices.append(b'%d' % i)
+return b'\n'.join(indices)
+
+
+def decodefileindices(files, data):
+try:
+subset = []
+if not data:
+return subset
+for strindex in data.split(b'\n'):
+i = int(strindex)
+if i < 0 or i >= len(files):
+return None
+subset.append(files[i])
+return subset
+except (ValueError, IndexError):
+# Perhaps someone had chosen the same key name (e.g. "added") and
+# used different syntax for the value.
+return None
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -546,7 +546,7 @@
 filesadded = None
 if filesadded is None:
 if compute_on_none:
-filesadded = scmutil.computechangesetfilesadded(self)
+filesadded = copies.computechangesetfilesadded(self)
 else:
 filesadded = []
 return filesadded
@@ -565,7 +565,7 @@
 filesremoved = None
 if filesremoved is None:
 if compute_on_none:
-filesremoved = scmutil.computechangesetfilesremoved(self)
+filesremoved = copies.computechangesetfilesremoved(self)
 else:
 filesremoved = []
 return filesremoved
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -16,6 +16,7 @@
 from .thirdparty import attr
 
 from . import (
+copies,
 encoding,
 error,
 pycompat,
@@ -89,61 +90,6 @@
 return b"\0".join(items)
 
 
-def encodecopies(files, copies):
-items = []
-for i, dst in enumerate(files):
-if dst in copies:
-items.append(b'%d\0%s' % (i, copies[dst]))
-if len(items) != len(copies):
-raise error.ProgrammingError(
-b'some copy targets 

D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 17023.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6953?vs=17008=17023

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

AFFECTED FILES
  mercurial/changelog.py
  mercurial/context.py
  mercurial/copies.py
  tests/test-copies-unrelated.t
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -309,7 +309,6 @@
   x -> z
   $ hg debugpathcopies 0 2
   x -> z (filelog !)
-  x -> z (sidedata !)
 
 Copy file that exists on both sides of the merge, different content
   $ newrepo
@@ -338,12 +337,14 @@
  x
   $ hg debugp1copies -r 2
   x -> z (changeset !)
+  x -> z (sidedata !)
   $ hg debugp2copies -r 2
-  x -> z (no-changeset !)
+  x -> z (no-changeset no-sidedata !)
   $ hg debugpathcopies 1 2
   x -> z (changeset !)
+  x -> z (sidedata !)
   $ hg debugpathcopies 0 2
-  x -> z (no-changeset !)
+  x -> z (no-changeset no-sidedata !)
 
 Copy x->y on one side of merge and copy x->z on the other side. Pathcopies 
from one parent
 of the merge to the merge should include the copy from the other side.
@@ -403,7 +404,7 @@
   $ hg debugpathcopies 2 3
   y -> z
   $ hg debugpathcopies 1 3
-  y -> z (no-filelog no-sidedata !)
+  y -> z (no-filelog !)
 
 Create x and y, then rename x to z on one side of merge, and rename y to z and
 modify z on the other side. When storing copies in the changeset, we don't
@@ -448,18 +449,16 @@
   o  0 add x and y
  x y
   $ hg debugpathcopies 1 4
-  y -> z (no-filelog no-sidedata !)
+  y -> z (no-filelog !)
   $ hg debugpathcopies 2 4
-  x -> z (no-filelog no-sidedata !)
+  x -> z (no-filelog !)
   $ hg debugpathcopies 0 4
   x -> z (filelog !)
-  x -> z (sidedata !)
-  y -> z (compatibility !)
-  y -> z (changeset !)
+  y -> z (no-filelog !)
   $ hg debugpathcopies 1 5
-  y -> z (no-filelog no-sidedata !)
+  y -> z (no-filelog !)
   $ hg debugpathcopies 2 5
-  x -> z (no-filelog no-sidedata !)
+  x -> z (no-filelog !)
   $ hg debugpathcopies 0 5
   x -> z
 
diff --git a/tests/test-copies-unrelated.t b/tests/test-copies-unrelated.t
--- a/tests/test-copies-unrelated.t
+++ b/tests/test-copies-unrelated.t
@@ -179,8 +179,8 @@
   o  0 add x
  x
   $ hg debugpathcopies 0 5
-  x -> y (no-filelog no-sidedata !)
-#if no-filelog no-sidedata
+  x -> y (no-filelog !)
+#if no-filelog
   $ hg graft -r 2
   grafting 2:* "modify x again" (glob)
   merging y and x to y
@@ -347,8 +347,8 @@
   o  0 base
  a
   $ hg debugpathcopies 1 5
-  x -> y (no-filelog no-sidedata !)
-#if no-filelog no-sidedata
+  x -> y (no-filelog !)
+#if no-filelog
   $ hg graft -r 2
   grafting 2:* "modify x" (glob)
   merging y and x to y
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -188,6 +188,8 @@
 
 def usechangesetcentricalgo(repo):
 """Checks if we should use changeset-centric copy algorithms"""
+if repo.filecopiesmode == b'changeset-sidedata':
+return True
 readfrom = repo.ui.config(b'experimental', b'copies.read-from')
 changesetsource = (b'changeset-only', b'compatibility')
 return readfrom in changesetsource
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -533,55 +533,76 @@
 return sorted(modified)
 
 def filesadded(self):
-source = self._repo.ui.config(b'experimental', b'copies.read-from')
 filesadded = self._changeset.filesadded
-if source == b'changeset-only':
-if filesadded is None:
+compute_on_none = True
+if self._repo.filecopiesmode == b'changeset-sidedata':
+compute_on_none = False
+else:
+source = self._repo.ui.config(b'experimental', b'copies.read-from')
+if source == b'changeset-only':
+compute_on_none = False
+elif source != b'compatibility':
+# filelog mode, ignore any changelog content
+filesadded = None
+if filesadded is None:
+if compute_on_none:
+filesadded = scmutil.computechangesetfilesadded(self)
+else:
 filesadded = []
-elif source == b'compatibility':
-if filesadded is None:
-filesadded = scmutil.computechangesetfilesadded(self)
-else:
-filesadded = scmutil.computechangesetfilesadded(self)
 return filesadded
 
 def filesremoved(self):
-source = self._repo.ui.config(b'experimental', b'copies.read-from')
 filesremoved = self._changeset.filesremoved
-if source == b'changeset-only':
-if filesremoved is None:
+compute_on_none = True
+if self._repo.filecopiesmode == b'changeset-sidedata':
+compute_on_none = False
+

D7037: context: make copies related function return None or a valid value

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  With the previous code, existing but empty value where not "decoded", leading 
to
  the method returning one of `None`, some valid value (`list` or `dict`) or
  `b''`.
  
  On a general basis, not explicitly checking for None is a source of bugs.
  Having a clean return types will help the side-data copies code in future
  changesets.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/changelog.py

CHANGE DETAILS

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -363,22 +363,30 @@
 @property
 def filesadded(self):
 rawindices = self.extra.get(b'filesadded')
-return rawindices and decodefileindices(self.files, rawindices)
+if rawindices is None:
+return None
+return decodefileindices(self.files, rawindices)
 
 @property
 def filesremoved(self):
 rawindices = self.extra.get(b'filesremoved')
-return rawindices and decodefileindices(self.files, rawindices)
+if rawindices is None:
+return None
+return decodefileindices(self.files, rawindices)
 
 @property
 def p1copies(self):
 rawcopies = self.extra.get(b'p1copies')
-return rawcopies and decodecopies(self.files, rawcopies)
+if rawcopies is None:
+return None
+return decodecopies(self.files, rawcopies)
 
 @property
 def p2copies(self):
 rawcopies = self.extra.get(b'p2copies')
-return rawcopies and decodecopies(self.files, rawcopies)
+if rawcopies is None:
+return None
+return decodecopies(self.files, rawcopies)
 
 @property
 def description(self):



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


D7036: test: fix zstd related output in pure tests

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute 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/D7036

AFFECTED FILES
  tests/test-upgrade-repo.t

CHANGE DETAILS

diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
--- a/tests/test-upgrade-repo.t
+++ b/tests/test-upgrade-repo.t
@@ -1420,14 +1420,15 @@
   sidedata:  yes no  no
   copies-sdc: no no  no
   plain-cl-delta:yesyes yes
-  compression:   zstd   zstdzlib
+  compression:   zstd   zstdzlib (zstd !)
+  compression:   zlib   zlibzlib (no-zstd !)
   compression-level: default default default
   $ cat .hg/requires
   dotencode
   exp-sidedata-flag
   fncache
   generaldelta
-  revlog-compression-zstd
+  revlog-compression-zstd (zstd !)
   revlogv1
   sparserevlog
   store
@@ -1448,13 +1449,14 @@
   sidedata:   no no  no
   copies-sdc: no no  no
   plain-cl-delta:yesyes yes
-  compression:   zstd   zstdzlib
+  compression:   zstd   zstdzlib (zstd !)
+  compression:   zlib   zlibzlib (no-zstd !)
   compression-level: default default default
   $ cat .hg/requires
   dotencode
   fncache
   generaldelta
-  revlog-compression-zstd
+  revlog-compression-zstd (zstd !)
   revlogv1
   sparserevlog
   store
@@ -1476,14 +1478,15 @@
   sidedata:  yesyes  no
   copies-sdc: no no  no
   plain-cl-delta:yesyes yes
-  compression:   zstd   zstdzlib
+  compression:   zstd   zstdzlib (zstd !)
+  compression:   zlib   zlibzlib (no-zstd !)
   compression-level: default default default
   $ cat .hg/requires
   dotencode
   exp-sidedata-flag
   fncache
   generaldelta
-  revlog-compression-zstd
+  revlog-compression-zstd (zstd !)
   revlogv1
   sparserevlog
   store



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


D6943: upgrade: allow for `sidedata` removal

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute added inline comments.

INLINE COMMENTS

> martinvonz wrote in test-sidedata.t:74-75
> Looks like this change should be in the parent

Actually, the text should says "downgrade from", on my way to fix that

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6943/new/

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

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


D7035: test: fix a comment in test-side-data.t

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  Thanks, I've folded this into D6943 

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7035/new/

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

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


D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> marmoute wrote in changelog.py:369-371
> On this side of the discussion, confusion increases I want `None` value to be 
> preserved (if not relevant now, if will quickly become so). As far as I 
> understand, `decodefileindices` does not do this.

I think we've talked about this long enough now that it's clear that changing 
this behavior is not the purpose of this patch and that it deserves its own 
patch where you can explain what you're changing and why.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

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


D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute added inline comments.

INLINE COMMENTS

> martinvonz wrote in changelog.py:369-371
> Actually, both `decodefileindices()` and `decodecopies()` seem to properly 
> handle the "empty input" case. So I think you can revert this change. As I 
> suggested earlier, it may be best as a separate patch anyway since it seems 
> unrelated to this patch (although maybe it is required by, if I'm still 
> misunderstanding and it really is a bug). Sorry I didn't notice this earlier.

On this side of the discussion, confusion increases I want `None` value to be 
preserved (if not relevant now, if will quickly become so). As far as I 
understand, `decodefileindices` does not do this.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

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


D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> marmoute wrote in changelog.py:369-371
> Yes, this is to handle `b''` in  different way from `None`.

Actually, both `decodefileindices()` and `decodecopies()` seem to properly 
handle the "empty input" case. So I think you can revert this change. As I 
suggested earlier, it may be best as a separate patch anyway since it seems 
unrelated to this patch (although maybe it is required by, if I'm still 
misunderstanding and it really is a bug). Sorry I didn't notice this earlier.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

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


D6989: push: support config option to require revs be specified when running push

2019-10-09 Thread spectral (Kyle Lippincott)
spectral updated this revision to Diff 17011.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6989?vs=16859=17011

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6989/new/

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/configitems.py
  mercurial/help/config.txt
  tests/test-push.t

CHANGE DETAILS

diff --git a/tests/test-push.t b/tests/test-push.t
--- a/tests/test-push.t
+++ b/tests/test-push.t
@@ -348,3 +348,55 @@
   [255]
 
   $ [ ! -f owned ] || echo 'you got owned'
+
+Test `commands.push.require-revs`
+-
+
+  $ hg clone -q test-revflag test-require-revs-source
+  $ hg init test-require-revs-dest
+  $ cd test-require-revs-source
+  $ cat >> .hg/hgrc << EOF
+  > [paths]
+  > default = ../test-require-revs-dest
+  > [commands]
+  > push.require-revs=1
+  > EOF
+  $ hg push
+  pushing to $TESTTMP/test-require-revs-dest
+  abort: no revisions specified to push
+  (did you mean "hg push -r ."?)
+  [255]
+  $ hg push -r 0
+  pushing to $TESTTMP/test-require-revs-dest
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  $ hg bookmark -r 0 push-this-bookmark
+(test that -B (bookmark) works for specifying "revs")
+  $ hg push -B push-this-bookmark
+  pushing to $TESTTMP/test-require-revs-dest
+  searching for changes
+  no changes found
+  exporting bookmark push-this-bookmark
+  [1]
+(test that -b (branch)  works for specifying "revs")
+  $ hg push -b default
+  pushing to $TESTTMP/test-require-revs-dest
+  searching for changes
+  abort: push creates new remote head [0-9a-f]+! (re)
+  (merge or see 'hg help push' for details about pushing new heads)
+  [255]
+(demonstrate that even though we don't have anything to exchange, we're still
+showing the error)
+  $ hg push
+  pushing to $TESTTMP/test-require-revs-dest
+  abort: no revisions specified to push
+  (did you mean "hg push -r ."?)
+  [255]
+  $ hg push --config paths.default:pushrev=0
+  pushing to $TESTTMP/test-require-revs-dest
+  searching for changes
+  no changes found
+  [1]
diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -442,6 +442,14 @@
 Show status of files in the working directory after successful commit.
 (default: False)
 
+``push.require-revs``
+Require revisions to push be specified using one or more mechanisms such as
+specifying them positionally on the command line, using ``-r``, ``-b``,
+and/or ``-B`` on the command line, or using ``paths.:pushrev`` in the
+configuration. If this is enabled and revisions are not specified, the
+command aborts.
+(default: False)
+
 ``resolve.confirm``
 Confirm before performing action if no filename is passed.
 (default: False)
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -228,6 +228,9 @@
 b'commands', b'grep.all-files', default=False, experimental=True,
 )
 coreconfigitem(
+b'commands', b'push.require-revs', default=False,
+)
+coreconfigitem(
 b'commands', b'resolve.confirm', default=False,
 )
 coreconfigitem(
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5615,6 +5615,9 @@
 raise error.Abort(
 _(b'default push revset for path evaluates to an empty set')
 )
+elif ui.configbool(b'commands', b'push.require-revs'):
+raise error.Abort(_(b'no revisions specified to push'),
+  hint=_(b'did you mean "hg push -r ."?'))
 
 repo._subtoppath = dest
 try:



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


D6954: sidedatacopies: move various copies related function to the copies modules

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 17009.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6954?vs=16955=17009

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6954/new/

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

AFFECTED FILES
  mercurial/changelog.py
  mercurial/context.py
  mercurial/copies.py
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -2219,23 +2219,3 @@
 mark,
 mark,
 )
-
-
-def computechangesetfilesadded(ctx):
-"""return the list of files added in a changeset
-"""
-added = []
-for f in ctx.files():
-if not any(f in p for p in ctx.parents()):
-added.append(f)
-return added
-
-
-def computechangesetfilesremoved(ctx):
-"""return the list of files removed in a changeset
-"""
-removed = []
-for f in ctx.files():
-if f not in ctx:
-removed.append(f)
-return removed
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -14,6 +14,7 @@
 from .i18n import _
 
 from . import (
+error,
 match as matchmod,
 node,
 pathutil,
@@ -855,6 +856,26 @@
 wctx[dst].markcopied(src)
 
 
+def computechangesetfilesadded(ctx):
+"""return the list of files added in a changeset
+"""
+added = []
+for f in ctx.files():
+if not any(f in p for p in ctx.parents()):
+added.append(f)
+return added
+
+
+def computechangesetfilesremoved(ctx):
+"""return the list of files removed in a changeset
+"""
+removed = []
+for f in ctx.files():
+if f not in ctx:
+removed.append(f)
+return removed
+
+
 def computechangesetcopies(ctx):
 """return the copies data for a changeset
 
@@ -879,3 +900,58 @@
 elif src in p2 and p2[src].filenode() == srcnode:
 p2copies[dst] = src
 return p1copies, p2copies
+
+
+def encodecopies(files, copies):
+items = []
+for i, dst in enumerate(files):
+if dst in copies:
+items.append(b'%d\0%s' % (i, copies[dst]))
+if len(items) != len(copies):
+raise error.ProgrammingError(
+b'some copy targets missing from file list'
+)
+return b"\n".join(items)
+
+
+def decodecopies(files, data):
+try:
+copies = {}
+if not data:
+return copies
+for l in data.split(b'\n'):
+strindex, src = l.split(b'\0')
+i = int(strindex)
+dst = files[i]
+copies[dst] = src
+return copies
+except (ValueError, IndexError):
+# Perhaps someone had chosen the same key name (e.g. "p1copies") and
+# used different syntax for the value.
+return None
+
+
+def encodefileindices(files, subset):
+subset = set(subset)
+indices = []
+for i, f in enumerate(files):
+if f in subset:
+indices.append(b'%d' % i)
+return b'\n'.join(indices)
+
+
+def decodefileindices(files, data):
+try:
+subset = []
+if not data:
+return subset
+for strindex in data.split(b'\n'):
+i = int(strindex)
+if i < 0 or i >= len(files):
+return None
+subset.append(files[i])
+return subset
+except (ValueError, IndexError):
+# Perhaps someone had chosen the same key name (e.g. "added") and
+# used different syntax for the value.
+return None
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -546,7 +546,7 @@
 filesadded = None
 if filesadded is None:
 if compute_on_none:
-filesadded = scmutil.computechangesetfilesadded(self)
+filesadded = copies.computechangesetfilesadded(self)
 else:
 filesadded = []
 return filesadded
@@ -565,7 +565,7 @@
 filesremoved = None
 if filesremoved is None:
 if compute_on_none:
-filesremoved = scmutil.computechangesetfilesremoved(self)
+filesremoved = copies.computechangesetfilesremoved(self)
 else:
 filesremoved = []
 return filesremoved
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -16,6 +16,7 @@
 from .thirdparty import attr
 
 from . import (
+copies,
 encoding,
 error,
 pycompat,
@@ -89,61 +90,6 @@
 return b"\0".join(items)
 
 
-def encodecopies(files, copies):
-items = []
-for i, dst in enumerate(files):
-if dst in copies:
-items.append(b'%d\0%s' % (i, copies[dst]))
-if len(items) != len(copies):
-raise error.ProgrammingError(
-b'some copy targets 

D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute marked an inline comment as done.
marmoute updated this revision to Diff 17008.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6953?vs=16954=17008

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

AFFECTED FILES
  mercurial/changelog.py
  mercurial/context.py
  mercurial/copies.py
  tests/test-copies-unrelated.t
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -309,7 +309,6 @@
   x -> z
   $ hg debugpathcopies 0 2
   x -> z (filelog !)
-  x -> z (sidedata !)
 
 Copy file that exists on both sides of the merge, different content
   $ newrepo
@@ -338,12 +337,14 @@
  x
   $ hg debugp1copies -r 2
   x -> z (changeset !)
+  x -> z (sidedata !)
   $ hg debugp2copies -r 2
-  x -> z (no-changeset !)
+  x -> z (no-changeset no-sidedata !)
   $ hg debugpathcopies 1 2
   x -> z (changeset !)
+  x -> z (sidedata !)
   $ hg debugpathcopies 0 2
-  x -> z (no-changeset !)
+  x -> z (no-changeset no-sidedata !)
 
 Copy x->y on one side of merge and copy x->z on the other side. Pathcopies 
from one parent
 of the merge to the merge should include the copy from the other side.
@@ -403,7 +404,7 @@
   $ hg debugpathcopies 2 3
   y -> z
   $ hg debugpathcopies 1 3
-  y -> z (no-filelog no-sidedata !)
+  y -> z (no-filelog !)
 
 Create x and y, then rename x to z on one side of merge, and rename y to z and
 modify z on the other side. When storing copies in the changeset, we don't
@@ -448,18 +449,16 @@
   o  0 add x and y
  x y
   $ hg debugpathcopies 1 4
-  y -> z (no-filelog no-sidedata !)
+  y -> z (no-filelog !)
   $ hg debugpathcopies 2 4
-  x -> z (no-filelog no-sidedata !)
+  x -> z (no-filelog !)
   $ hg debugpathcopies 0 4
   x -> z (filelog !)
-  x -> z (sidedata !)
-  y -> z (compatibility !)
-  y -> z (changeset !)
+  y -> z (no-filelog !)
   $ hg debugpathcopies 1 5
-  y -> z (no-filelog no-sidedata !)
+  y -> z (no-filelog !)
   $ hg debugpathcopies 2 5
-  x -> z (no-filelog no-sidedata !)
+  x -> z (no-filelog !)
   $ hg debugpathcopies 0 5
   x -> z
 
diff --git a/tests/test-copies-unrelated.t b/tests/test-copies-unrelated.t
--- a/tests/test-copies-unrelated.t
+++ b/tests/test-copies-unrelated.t
@@ -179,8 +179,8 @@
   o  0 add x
  x
   $ hg debugpathcopies 0 5
-  x -> y (no-filelog no-sidedata !)
-#if no-filelog no-sidedata
+  x -> y (no-filelog !)
+#if no-filelog
   $ hg graft -r 2
   grafting 2:* "modify x again" (glob)
   merging y and x to y
@@ -347,8 +347,8 @@
   o  0 base
  a
   $ hg debugpathcopies 1 5
-  x -> y (no-filelog no-sidedata !)
-#if no-filelog no-sidedata
+  x -> y (no-filelog !)
+#if no-filelog
   $ hg graft -r 2
   grafting 2:* "modify x" (glob)
   merging y and x to y
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -188,6 +188,8 @@
 
 def usechangesetcentricalgo(repo):
 """Checks if we should use changeset-centric copy algorithms"""
+if repo.filecopiesmode == b'changeset-sidedata':
+return True
 readfrom = repo.ui.config(b'experimental', b'copies.read-from')
 changesetsource = (b'changeset-only', b'compatibility')
 return readfrom in changesetsource
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -533,55 +533,76 @@
 return sorted(modified)
 
 def filesadded(self):
-source = self._repo.ui.config(b'experimental', b'copies.read-from')
 filesadded = self._changeset.filesadded
-if source == b'changeset-only':
-if filesadded is None:
+compute_on_none = True
+if self._repo.filecopiesmode == b'changeset-sidedata':
+compute_on_none = False
+else:
+source = self._repo.ui.config(b'experimental', b'copies.read-from')
+if source == b'changeset-only':
+compute_on_none = False
+elif source != b'compatibility':
+# filelog mode, ignore any changelog content
+filesadded = None
+if filesadded is None:
+if compute_on_none:
+filesadded = scmutil.computechangesetfilesadded(self)
+else:
 filesadded = []
-elif source == b'compatibility':
-if filesadded is None:
-filesadded = scmutil.computechangesetfilesadded(self)
-else:
-filesadded = scmutil.computechangesetfilesadded(self)
 return filesadded
 
 def filesremoved(self):
-source = self._repo.ui.config(b'experimental', b'copies.read-from')
 filesremoved = self._changeset.filesremoved
-if source == b'changeset-only':
-if filesremoved is None:
+compute_on_none = True
+if self._repo.filecopiesmode == b'changeset-sidedata':
+  

D6955: sidedatacopies: deal with upgrading and downgrading to that format

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 17010.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6955?vs=16956=17010

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6955/new/

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

AFFECTED FILES
  mercurial/copies.py
  mercurial/upgrade.py
  tests/test-copies-in-changeset.t

CHANGE DETAILS

diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t
--- a/tests/test-copies-in-changeset.t
+++ b/tests/test-copies-in-changeset.t
@@ -450,4 +450,91 @@
   $ hg ci -Aqm 'add a'
   $ hg mv a b
   $ hg ci -m 'remove a' a
+
+#if sidedata
+
+Test upgrading/downgrading to sidedata storage
+==
+
+downgrading (keeping some sidedata)
+
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:  yesyes  no
+  copies-sdc:yesyes  no
+  plain-cl-delta:yesyes yes
+  compression:   zlib   zlibzlib
+  compression-level: default default default
+  $ hg debugsidedata -c -- 0
+  4 sidedata entries
+   entry-0010 size 0
+   entry-0011 size 0
+   entry-0012 size 1
+   entry-0013 size 0
+  $ hg debugsidedata -c -- 1
+  4 sidedata entries
+   entry-0010 size 0
+   entry-0011 size 0
+   entry-0012 size 0
+   entry-0013 size 1
+  $ hg debugsidedata -m -- 0
+  $ cat << EOF > .hg/hgrc
+  > [format]
+  > use-side-data = yes
+  > exp-use-copies-side-data-changeset = no
+  > EOF
+  $ hg debugupgraderepo --run --quiet --no-backup > /dev/null
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:  yesyes  no
+  copies-sdc: no no  no
+  plain-cl-delta:yesyes yes
+  compression:   zlib   zlibzlib
+  compression-level: default default default
+  $ hg debugsidedata -c -- 0
+  $ hg debugsidedata -c -- 1
+  $ hg debugsidedata -m -- 0
+
+upgrading
+
+  $ cat << EOF > .hg/hgrc
+  > [format]
+  > exp-use-copies-side-data-changeset = yes
+  > EOF
+  $ hg debugupgraderepo --run --quiet --no-backup > /dev/null
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:  yesyes  no
+  copies-sdc:yesyes  no
+  plain-cl-delta:yesyes yes
+  compression:   zlib   zlibzlib
+  compression-level: default default default
+  $ hg debugsidedata -c -- 0
+  4 sidedata entries
+   entry-0010 size 0
+   entry-0011 size 0
+   entry-0012 size 1
+   entry-0013 size 0
+  $ hg debugsidedata -c -- 1
+  4 sidedata entries
+   entry-0010 size 0
+   entry-0011 size 0
+   entry-0012 size 0
+   entry-0013 size 1
+  $ hg debugsidedata -m -- 0
+
+#endif
+
   $ cd ..
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -13,6 +13,7 @@
 from .pycompat import getattr
 from . import (
 changelog,
+copies,
 error,
 filelog,
 hg,
@@ -31,7 +32,6 @@
 RECLONES_REQUIREMENTS = {
 b'generaldelta',
 localrepo.SPARSEREVLOG_REQUIREMENT,
-localrepo.SIDEDATA_REQUIREMENT,
 }
 
 
@@ -77,6 +77,7 @@
 supported = {
 localrepo.SPARSEREVLOG_REQUIREMENT,
 localrepo.SIDEDATA_REQUIREMENT,
+localrepo.COPIESSDC_REQUIREMENT,
 }
 for name in compression.compengines:
 engine = compression.compengines[name]
@@ -103,6 +104,7 @@
 b'store',
 localrepo.SPARSEREVLOG_REQUIREMENT,
 localrepo.SIDEDATA_REQUIREMENT,
+localrepo.COPIESSDC_REQUIREMENT,
 }
 for name in compression.compengines:
 engine = compression.compengines[name]
@@ -129,6 +131,7 @@
 b'generaldelta',
 localrepo.SPARSEREVLOG_REQUIREMENT,
 localrepo.SIDEDATA_REQUIREMENT,
+localrepo.COPIESSDC_REQUIREMENT,
 }
 for name in compression.compengines:
 engine = compression.compengines[name]
@@ -698,6 +701,7 @@
 def getsidedatacompanion(srcrepo, dstrepo):
 sidedatacompanion = None
 removedreqs = srcrepo.requirements - dstrepo.requirements
+addedreqs = dstrepo.requirements - srcrepo.requirements
 if localrepo.SIDEDATA_REQUIREMENT in removedreqs:
 
 def sidedatacompanion(rl, rev):
@@ -706,6 +710,10 @@
 return True, (), {}
 return False, (), {}
 
+elif localrepo.COPIESSDC_REQUIREMENT in addedreqs:
+sidedatacompanion = copies.getsidedataadder(srcrepo, dstrepo)
+elif localrepo.COPIESSDC_REQUIREMENT in removedreqs:
+

D6734: git: RFC of a new extension to _directly_ operate on git repositories

2019-10-09 Thread durin42 (Augie Fackler)
durin42 edited the summary of this revision.
durin42 updated this revision to Diff 17007.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6734?vs=16858=17007

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6734/new/

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

AFFECTED FILES
  hgext/git/__init__.py
  hgext/git/dirstate.py
  hgext/git/gitlog.py
  hgext/git/index.py
  mercurial/transaction.py
  setup.py
  tests/test-check-interfaces.py
  tests/test-git-interop.t

CHANGE DETAILS

diff --git a/tests/test-git-interop.t b/tests/test-git-interop.t
new file mode 100644
--- /dev/null
+++ b/tests/test-git-interop.t
@@ -0,0 +1,190 @@
+This test requires pygit2:
+  > python -c 'import pygit2' || exit 80
+
+Setup:
+  > GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
+  > GIT_AUTHOR_EMAIL='t...@example.org'; export GIT_AUTHOR_EMAIL
+  > GIT_AUTHOR_DATE="2007-01-01 00:00:00 +"; export GIT_AUTHOR_DATE
+  > GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
+  > GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
+  > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
+
+  > count=10
+  > gitcommit() {
+  >GIT_AUTHOR_DATE="2007-01-01 00:00:$count +";
+  >GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
+  >git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
+  >count=`expr $count + 1`
+  >  }
+
+  > echo "[extensions]" >> $HGRCPATH
+  > echo "git=" >> $HGRCPATH
+
+Make a new repo with git:
+  $ mkdir foo
+  $ cd foo
+  $ git init
+  Initialized empty Git repository in $TESTTMP/foo/.git/
+Ignore the .hg directory within git:
+  $ echo .hg >> .git/info/exclude
+  $ echo alpha > alpha
+  $ git add alpha
+  $ gitcommit -am 'Add alpha'
+  $ echo beta > beta
+  $ git add beta
+  $ gitcommit -am 'Add beta'
+  $ echo gamma > gamma
+  $ git status
+  On branch master
+  Untracked files:
+(use "git add ..." to include in what will be committed)
+  
+   gamma
+  
+  nothing added to commit but untracked files present (use "git add" to track)
+
+Without creating the .hg, hg status fails:
+  $ hg status
+  abort: no repository found in '$TESTTMP/foo' (.hg not found)!
+  [255]
+But if you run hg init --git, it works:
+  $ hg init --git
+  $ hg id
+  3d9be8deba43 master
+  $ hg status
+  ? gamma
+Log works too:
+  $ hg log
+  changeset:   1:3d9be8deba43
+  bookmark:master
+  user:test 
+  date:Mon Jan 01 00:00:11 2007 +
+  summary: Add beta
+  
+  changeset:   0:c5864c9d16fb
+  user:test 
+  date:Mon Jan 01 00:00:10 2007 +
+  summary: Add alpha
+  
+
+
+and bookmarks:
+  $ hg bookmarks
+   * master1:3d9be8deba43
+
+diff even works transparently in both systems:
+  $ echo blah >> alpha
+  $ git diff
+  diff --git a/alpha b/alpha
+  index 4a58007..faed1b7 100644
+  --- a/alpha
+  +++ b/alpha
+  @@ -1 +1,2 @@
+   alpha
+  +blah
+  $ hg diff --git
+  diff --git a/alpha b/alpha
+  --- a/alpha
+  +++ b/alpha
+  @@ -1,1 +1,2 @@
+   alpha
+  +blah
+
+Remove a file, it shows as such:
+  $ rm alpha
+  $ hg status
+  ! alpha
+  ? gamma
+
+Revert works:
+  $ hg revert alpha --traceback
+  $ hg status
+  ? gamma
+  $ git status
+  On branch master
+  Untracked files:
+(use "git add ..." to include in what will be committed)
+  
+   gamma
+  
+  nothing added to commit but untracked files present (use "git add" to track)
+
+Add shows sanely in both:
+  $ hg add gamma
+  $ hg status
+  A gamma
+  $ hg files
+  alpha
+  beta
+  gamma
+  $ git ls-files
+  alpha
+  beta
+  gamma
+  $ git status
+  On branch master
+  Changes to be committed:
+(use "git reset HEAD ..." to unstage)
+  
+   new file:   gamma
+  
+
+forget does what it should as well:
+  $ hg forget gamma
+  $ hg status
+  ? gamma
+  $ git status
+  On branch master
+  Untracked files:
+(use "git add ..." to include in what will be committed)
+  
+   gamma
+  
+  nothing added to commit but untracked files present (use "git add" to track)
+
+hg log FILE
+
+  $ echo a >> alpha
+  $ hg ci -m 'more alpha'
+  $ echo b >> beta
+  $ hg ci -m 'more beta'
+  $ echo a >> alpha
+  $ hg ci -m 'even more alpha'
+  $ hg log -G alpha
+  @  changeset:   4:bd975ddde71c
+  :  bookmark:master
+  :  user:test 
+  :  date:Thu Jan 01 00:00:00 1970 +
+  :  summary: even more alpha
+  :
+  o  changeset:   2:77f597222800
+  :  user:test 
+  :  date:Thu Jan 01 00:00:00 1970 +
+  :  summary: more alpha
+  :
+  o  changeset:   0:c5864c9d16fb
+ user:test 
+ date:Mon Jan 01 00:00:10 2007 +
+ summary: Add alpha
+  
+  $ hg log -G beta
+  o  changeset:   3:b40d4fed5e27
+  :  user:test 
+  :  date:Thu Jan 01 00:00:00 1970 +
+  :  summary: more beta
+  :
+  o  changeset:   1:3d9be8deba43
+  |  user:test 
+  ~  date:Mon Jan 01 00:00:11 2007 +
+ summary:

mercurial@43130: 13 new changesets

2019-10-09 Thread Mercurial Commits
13 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/57efd5bd2ca2
changeset:   43118:57efd5bd2ca2
user:Denis Laxalde 
date:Wed Oct 09 15:28:16 2019 +0200
summary: py3: decode prompt string before calling rawinput

https://www.mercurial-scm.org/repo/hg/rev/c9093ae8d6c4
changeset:   43119:c9093ae8d6c4
user:Denis Laxalde 
date:Wed Oct 09 15:24:14 2019 +0200
summary: py3: flush ui after each message in interactive patch filtering

https://www.mercurial-scm.org/repo/hg/rev/97f80dd21312
changeset:   43120:97f80dd21312
user:Pierre-Yves David 
date:Tue Oct 08 01:15:28 2019 -0400
summary: perf: document `perfstatus`

https://www.mercurial-scm.org/repo/hg/rev/ce315b1fc9a7
changeset:   43121:ce315b1fc9a7
user:Pierre-Yves David 
date:Tue Oct 08 01:46:57 2019 -0400
summary: perf: document `perfdirstate`

https://www.mercurial-scm.org/repo/hg/rev/436a6a31df38
changeset:   43122:436a6a31df38
user:Pierre-Yves David 
date:Tue Oct 08 01:57:10 2019 -0400
summary: perf: use `setup` function in `perfdirstate`

https://www.mercurial-scm.org/repo/hg/rev/69301b79fd36
changeset:   43123:69301b79fd36
user:Pierre-Yves David 
date:Tue Oct 08 01:47:35 2019 -0400
summary: perf: document `perfdirstatedirs`

https://www.mercurial-scm.org/repo/hg/rev/100e7e0cdaad
changeset:   43124:100e7e0cdaad
user:Pierre-Yves David 
date:Tue Oct 08 02:08:41 2019 -0400
summary: perf: use `setup` function in `perfdirstatedirs`

https://www.mercurial-scm.org/repo/hg/rev/56494a2bfe2f
changeset:   43125:56494a2bfe2f
user:Pierre-Yves David 
date:Tue Oct 08 01:48:10 2019 -0400
summary: perf: document `perfdirstatefoldmap`

https://www.mercurial-scm.org/repo/hg/rev/e337d8247375
changeset:   43126:e337d8247375
user:Pierre-Yves David 
date:Tue Oct 08 02:16:15 2019 -0400
summary: perf: use `setup` function in `perfdirstatefoldmap`

https://www.mercurial-scm.org/repo/hg/rev/0b32206c3c86
changeset:   43127:0b32206c3c86
user:Pierre-Yves David 
date:Tue Oct 08 01:49:18 2019 -0400
summary: perf: document `perfdirfoldmap`

https://www.mercurial-scm.org/repo/hg/rev/ad801d4af7cd
changeset:   43128:ad801d4af7cd
user:Pierre-Yves David 
date:Tue Oct 08 02:12:15 2019 -0400
summary: perf: use `setup` function in `perfdirfoldmap`

https://www.mercurial-scm.org/repo/hg/rev/97f9ef777a75
changeset:   43129:97f9ef777a75
user:Pierre-Yves David 
date:Tue Oct 08 01:49:34 2019 -0400
summary: perf: document `perfdirstatewrite`

https://www.mercurial-scm.org/repo/hg/rev/c88075eb28e3
changeset:   43130:c88075eb28e3
bookmark:@
tag: tip
user:Pierre-Yves David 
date:Tue Oct 08 02:19:04 2019 -0400
summary: perf: use `setup` function in `perfdirstatewrite`

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


D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute added inline comments.
marmoute marked 3 inline comments as done.

INLINE COMMENTS

> martinvonz wrote in changelog.py:369-371
> I think you're saying that you changed it in order to handle `rawindices == 
> b''` correctly. Makes sense.

Yes, this is to handle `b''` in  different way from `None`.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

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


D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute added inline comments.

INLINE COMMENTS

> martinvonz wrote in context.py:536-550
> Is there a way of writing `self._repo.filecopiesmode != 
> b'changeset-sidedata'` in positive way? Maybe  `self._repo.filecopiesmode is 
> None`? The `source != b'changeset-only'` is because we want any 
> invalid/unexpected config to be treated as "filelog-only".
> 
> I won't insist on changing.

What about something like this: We "duplicate" the intend code, and factor the 
actual "computation" out.

  def filesadded(self):
  filesadded = self._changeset.filesadded
  compute_on_none = True
  if self._repo.filecopiesmode == b'changeset-sidedata':
  compute_on_none = False
  else:
  source = self._repo.ui.config(b'experimental', b'copies.read-from')
  if source == b'changeset-only':
  compute_on_none = False
  elif source != b'compatibility':
  # filelog mode, ignore any changelog content
  filesadded = None
  if filesadded is None:
  if compute_on_none:
  filesadded = scmutil.computechangesetfilesadded(self)
  else:
  filesadded = []
  return filesadded

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

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


D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> marmoute wrote in changelog.py:369-371
> I am confused, the function should return a list or None. Since rawindides 
> are bytes, they are not eligible for returns.
> I updated the code as follow:
> 
>   --- a/mercurial/changelog.py
>   +++ b/mercurial/changelog.py
>   @@ -366,9 +366,9 @@ class changelogrevision(object):
>rawindices = self._sidedata.get(sidedatamod.SD_FILESADDED)
>else:
>rawindices = self.extra.get(b'filesadded')
>   -if rawindices is not None:
>   -rawindices = decodefileindices(self.files, rawindices)
>   -return rawindices
>   +if rawindices is None:
>   +return None
>   +return decodefileindices(self.files, rawindices)
>
>@property
>def filesremoved(self):

I think you're saying that you changed it in order to handle `rawindices == 
b''` correctly. Makes sense.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

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


D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute added inline comments.

INLINE COMMENTS

> martinvonz wrote in changelog.py:369-371
> I thought the reason you explicitly did `if rawindices is not None` was in 
> order to not run the next statement if `rawindices` was an empty list. But 
> that should have no effect anyway, so I was clearly wrong about that. So why 
> did you make the `is not None` explicit? Can you just revert it if there was 
> no good reason for it?

I am confused, the function should return a list or None. Since rawindides are 
bytes, they are not eligible for returns.
I updated the code as follow:

  --- a/mercurial/changelog.py
  +++ b/mercurial/changelog.py
  @@ -366,9 +366,9 @@ class changelogrevision(object):
   rawindices = self._sidedata.get(sidedatamod.SD_FILESADDED)
   else:
   rawindices = self.extra.get(b'filesadded')
  -if rawindices is not None:
  -rawindices = decodefileindices(self.files, rawindices)
  -return rawindices
  +if rawindices is None:
  +return None
  +return decodefileindices(self.files, rawindices)
   
   @property
   def filesremoved(self):

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

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


D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> marmoute wrote in context.py:536-550
> I think I prefer my version for being a bit more explicite (all `if`s are 
> positive) and hence easier to read for people new to this code. However, I 
> don't mind your version if you really want it that way. Just let me know.

Is there a way of writing `self._repo.filecopiesmode != b'changeset-sidedata'` 
in positive way? Maybe  `self._repo.filecopiesmode is None`? The `source != 
b'changeset-only'` is because we want any invalid/unexpected config to be 
treated as "filelog-only".

I won't insist on changing.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

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


D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute added inline comments.

INLINE COMMENTS

> martinvonz wrote in context.py:536-550
> What do you think about writing this as follows? That reduces some of the `if 
> filesremoved is None: filesremoved = []` duplication.
> 
>   filesadded = self._changeset.filesadded
>   if self._repo.filecopiesmode != b'changeset-sidedata':
>   source = self._repo.ui.config(b'experimental', b'copies.read-from')
>   if source == b'compatibility':
>   if filesadded is None:
>   filesadded = copies.computechangesetfilesadded(self)
>   elif source != b'changeset-only':
>   filesadded = copies.computechangesetfilesadded(self)
>   if filesadded is None:
>   filesadded = []
>   return filesadded
> 
> Analogous changes can be made to `filesremoved()` and `p[12]copies()`.

I think I prefer my version for being a bit more explicite (all `if`s are 
positive) and hence easier to read for people new to this code. However, I 
don't mind your version if you really want it that way. Just let me know.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

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


D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> marmoute wrote in changelog.py:369-371
> > I see that you've changed this code to return an empty list of files when 
> > the list of indices was itself an empty list.
> 
> I dont' follow this sentence. What do you mean ?

I thought the reason you explicitly did `if rawindices is not None` was in 
order to not run the next statement if `rawindices` was an empty list. But that 
should have no effect anyway, so I was clearly wrong about that. So why did you 
make the `is not None` explicit? Can you just revert it if there was no good 
reason for it?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

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


D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute added inline comments.

INLINE COMMENTS

> martinvonz wrote in changelog.py:369-371
> Calling the list of filenames `rawindices` is misleading. I see that you've 
> changed this code to return an empty list of files when the list of indices 
> was itself an empty list. That makes sense. Could you extract that to a 
> separate patch ? Does it matter in practice for sidedata? Please explain in 
> the commit message if it does. That patch would also assign the decoded list 
> of indices to a variable called `files` or something like that.

> I see that you've changed this code to return an empty list of files when the 
> list of indices was itself an empty list.

I dont' follow this sentence. What do you mean ?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

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


D6955: sidedatacopies: deal with upgrading and downgrading to that format

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> copies.py:988
> +sidedata = {}
> +if util.safehasattr(revlog, b'filteredrevs'):  # this is a changelog
> +sidedata = _getsidedata(srcrepo, rev)

nit: drop the `b''` here and below

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6955/new/

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

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


D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> test-copies.t:457-459
> +  y -> z (sidedata !)
>y -> z (compatibility !)
>y -> z (changeset !)

nit: combine these into a `no-filelog` case?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

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


D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> context.py:536-550
>  filesadded = self._changeset.filesadded
> -if True:
> +if self._repo.filecopiesmode == b'changeset-sidedata':
> +if filesadded is None:
> +filesadded = []
> +else:
>  source = self._repo.ui.config(b'experimental', 
> b'copies.read-from')
>  if source == b'changeset-only':

What do you think about writing this as follows? That reduces some of the `if 
filesremoved is None: filesremoved = []` duplication.

  filesadded = self._changeset.filesadded
  if self._repo.filecopiesmode != b'changeset-sidedata':
  source = self._repo.ui.config(b'experimental', b'copies.read-from')
  if source == b'compatibility':
  if filesadded is None:
  filesadded = copies.computechangesetfilesadded(self)
  elif source != b'changeset-only':
  filesadded = copies.computechangesetfilesadded(self)
  if filesadded is None:
  filesadded = []
  return filesadded

Analogous changes can be made to `filesremoved()` and `p[12]copies()`.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

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


D6950: sidedatacopies: write copies information in sidedata when applicable

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHGd37361888720: sidedatacopies: write copies information in 
sidedata when applicable (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6950?vs=16951=17005

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6950/new/

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

AFFECTED FILES
  mercurial/changelog.py
  mercurial/interfaces/repository.py
  mercurial/localrepo.py
  mercurial/revlogutils/sidedata.py
  tests/test-copies-in-changeset.t

CHANGE DETAILS

diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t
--- a/tests/test-copies-in-changeset.t
+++ b/tests/test-copies-in-changeset.t
@@ -75,7 +75,17 @@
   p1copies: 0\x00a (esc)
   1\x00a (esc)
   2\x00a (esc)
-
+#else
+  $ hg debugsidedata -c -v -- -1
+  4 sidedata entries
+   entry-0010 size 11
+'0\x00a\n1\x00a\n2\x00a'
+   entry-0011 size 0
+''
+   entry-0012 size 5
+'0\n1\n2'
+   entry-0013 size 0
+''
 #endif
 
   $ hg showcopies
@@ -107,6 +117,17 @@
   
   p1copies: 1\x00b (esc)
 
+#else
+  $ hg debugsidedata -c -v -- -1
+  4 sidedata entries
+   entry-0010 size 3
+'1\x00b'
+   entry-0011 size 0
+''
+   entry-0012 size 1
+'1'
+   entry-0013 size 1
+'0'
 #endif
 
   $ hg showcopies
@@ -145,6 +166,17 @@
   
   p1copies: 0\x00b2 (esc)
 
+#else
+  $ hg debugsidedata -c -v -- -1
+  4 sidedata entries
+   entry-0010 size 4
+'0\x00b2'
+   entry-0011 size 0
+''
+   entry-0012 size 0
+''
+   entry-0013 size 0
+''
 #endif
 
   $ hg showcopies
@@ -197,6 +229,17 @@
   2\x00f (esc)
   p2copies: 1\x00d (esc)
 
+#else
+  $ hg debugsidedata -c -v -- -1
+  4 sidedata entries
+   entry-0010 size 7
+'0\x00a\n2\x00f'
+   entry-0011 size 3
+'1\x00d'
+   entry-0012 size 5
+'0\n1\n2'
+   entry-0013 size 0
+''
 #endif
 
   $ hg showcopies
@@ -218,6 +261,16 @@
   p2copies: 
 #else
   $ hg ci -m 'copy a to j'
+  $ hg debugsidedata -c -v -- -1
+  4 sidedata entries
+   entry-0010 size 3
+'0\x00a'
+   entry-0011 size 0
+''
+   entry-0012 size 1
+'0'
+   entry-0013 size 0
+''
 #endif
   $ hg debugdata j 0
   \x01 (esc)
@@ -243,6 +296,16 @@
 #else
   $ hg ci --amend -m 'copy a to j, v2'
   saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob)
+  $ hg debugsidedata -c -v -- -1
+  4 sidedata entries
+   entry-0010 size 3
+'0\x00a'
+   entry-0011 size 0
+''
+   entry-0012 size 1
+'0'
+   entry-0013 size 0
+''
 #endif
   $ hg showcopies --config experimental.copies.read-from=filelog-only
   a -> j
@@ -260,6 +323,16 @@
   p2copies: 
 #else
   $ hg ci -m 'modify j'
+  $ hg debugsidedata -c -v -- -1
+  4 sidedata entries
+   entry-0010 size 0
+''
+   entry-0011 size 0
+''
+   entry-0012 size 0
+''
+   entry-0013 size 0
+''
 #endif
 
 Test writing only to filelog
@@ -273,6 +346,16 @@
   
 #else
   $ hg ci -m 'copy a to k'
+  $ hg debugsidedata -c -v -- -1
+  4 sidedata entries
+   entry-0010 size 3
+'0\x00a'
+   entry-0011 size 0
+''
+   entry-0012 size 1
+'0'
+   entry-0013 size 0
+''
 #endif
 
   $ hg debugdata k 0
diff --git a/mercurial/revlogutils/sidedata.py 
b/mercurial/revlogutils/sidedata.py
--- a/mercurial/revlogutils/sidedata.py
+++ b/mercurial/revlogutils/sidedata.py
@@ -48,6 +48,12 @@
 SD_TEST6 = 6
 SD_TEST7 = 7
 
+# key to store copies related information
+SD_P1COPIES = 8
+SD_P2COPIES = 9
+SD_FILESADDED = 10
+SD_FILESREMOVED = 11
+
 # internal format constant
 SIDEDATA_HEADER = struct.Struct(r'>H')
 SIDEDATA_ENTRY = struct.Struct(r'>HL20s')
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -825,10 +825,13 @@
 else:  # explicitly mark repo as using revlogv0
 options[b'revlogv0'] = True
 
-writecopiesto = ui.config(b'experimental', b'copies.write-to')
-copiesextramode = (b'changeset-only', b'compatibility')
-if writecopiesto in copiesextramode:
-options[b'copies-storage'] = b'extra'
+if COPIESSDC_REQUIREMENT in requirements:
+options[b'copies-storage'] = b'changeset-sidedata'
+else:
+writecopiesto = ui.config(b'experimental', b'copies.write-to')
+copiesextramode = (b'changeset-only', b'compatibility')
+if writecopiesto in copiesextramode:
+options[b'copies-storage'] = b'extra'
 
 return options
 
@@ -1182,6 +1185,10 @@
 
 self._extrafilterid = repoview.extrafilter(ui)
 
+self.filecopiesmode = None
+if COPIESSDC_REQUIREMENT in self.requirements:
+self.filecopiesmode = b'changeset-sidedata'
+
 def _getvfsward(self, origfunc):
 """build a ward for self.vfs"""
 rref = weakref.ref(self)
@@ -2949,12 +2956,17 @@
 p1, p2 = ctx.p1(), ctx.p2()
 

D6951: sidedatacopies: get and store sidedata in the changelogrevision object

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHGc42df030a9eb: sidedatacopies: get and store sidedata in the 
changelogrevision object (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6951?vs=16952=17006

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6951/new/

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

AFFECTED FILES
  mercurial/changelog.py

CHANGE DETAILS

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -268,9 +268,10 @@
 __slots__ = (
 r'_offsets',
 r'_text',
+r'_sidedata',
 )
 
-def __new__(cls, text):
+def __new__(cls, text, sidedata):
 if not text:
 return _changelogrevision(extra=_defaultextra)
 
@@ -302,6 +303,7 @@
 
 self._offsets = (nl1, nl2, nl3, doublenl)
 self._text = text
+self._sidedata = sidedata
 
 return self
 
@@ -613,12 +615,13 @@
 ``changelogrevision`` instead, as it is faster for partial object
 access.
 """
-c = changelogrevision(self.revision(node))
+c = changelogrevision(*self._revisiondata(node))
 return (c.manifest, c.user, c.date, c.files, c.description, c.extra)
 
 def changelogrevision(self, nodeorrev):
 """Obtain a ``changelogrevision`` for a node or revision."""
-return changelogrevision(self.revision(nodeorrev))
+text, sidedata = self._revisiondata(nodeorrev)
+return changelogrevision(text, sidedata)
 
 def readfiles(self, node):
 """



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


D6946: sidedatacopies: teach upgrade about the new requirement

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHGa329976b0bb5: sidedatacopies: teach upgrade about the new 
requirement (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6946?vs=16950=17001

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6946/new/

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

AFFECTED FILES
  mercurial/upgrade.py
  tests/test-lfs-serve.t
  tests/test-sidedata.t
  tests/test-upgrade-repo.t

CHANGE DETAILS

diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
--- a/tests/test-upgrade-repo.t
+++ b/tests/test-upgrade-repo.t
@@ -58,6 +58,7 @@
   generaldelta:  yes
   sparserevlog:  yes
   sidedata:   no
+  copies-sdc: no
   plain-cl-delta:yes
   compression:   zlib
   compression-level: default
@@ -68,6 +69,7 @@
   generaldelta:  yesyes yes
   sparserevlog:  yesyes yes
   sidedata:   no no  no
+  copies-sdc: no no  no
   plain-cl-delta:yesyes yes
   compression:   zlib   zlibzlib
   compression-level: default default default
@@ -78,6 +80,7 @@
   generaldelta:  yesyes yes
   sparserevlog:  yesyes yes
   sidedata:   no no  no
+  copies-sdc: no no  no
   plain-cl-delta:yesyes yes
   compression:   zlib   zlibzlib
   compression-level: default default default
@@ -88,6 +91,7 @@
   [formatvariant.name.uptodate|generaldelta: 
][formatvariant.repo.uptodate| yes][formatvariant.config.default|
yes][formatvariant.default| yes]
   [formatvariant.name.uptodate|sparserevlog: 
][formatvariant.repo.uptodate| yes][formatvariant.config.default|
yes][formatvariant.default| yes]
   [formatvariant.name.uptodate|sidedata: 
][formatvariant.repo.uptodate|  no][formatvariant.config.default| 
no][formatvariant.default|  no]
+  [formatvariant.name.uptodate|copies-sdc:   
][formatvariant.repo.uptodate|  no][formatvariant.config.default| 
no][formatvariant.default|  no]
   [formatvariant.name.uptodate|plain-cl-delta:   
][formatvariant.repo.uptodate| yes][formatvariant.config.default|
yes][formatvariant.default| yes]
   [formatvariant.name.uptodate|compression:  
][formatvariant.repo.uptodate| zlib][formatvariant.config.default|   
zlib][formatvariant.default|zlib]
   
[formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| 
default][formatvariant.config.default| default][formatvariant.default| default]
@@ -124,6 +128,12 @@
 "repo": false
},
{
+"config": false,
+"default": false,
+"name": "copies-sdc",
+"repo": false
+   },
+   {
 "config": true,
 "default": true,
 "name": "plain-cl-delta",
@@ -152,6 +162,9 @@
   sidedata
  Allows storage of extra data alongside a revision.
   
+  copies-sdc
+ Allows to use more efficient algorithm to deal with copy tracing.
+  
   additional optimizations are available by specifying "--optimize ":
   
   re-delta-parent
@@ -179,6 +192,9 @@
   sidedata
  Allows storage of extra data alongside a revision.
   
+  copies-sdc
+ Allows to use more efficient algorithm to deal with copy tracing.
+  
   re-delta-parent
  deltas within internal storage will choose a new base revision if needed
   
@@ -206,6 +222,9 @@
   sidedata
  Allows storage of extra data alongside a revision.
   
+  copies-sdc
+ Allows to use more efficient algorithm to deal with copy tracing.
+  
   re-delta-parent
  deltas within internal storage will choose a new base revision if needed
   
@@ -242,6 +261,7 @@
   generaldelta:   no
   sparserevlog:   no
   sidedata:   no
+  copies-sdc: no
   plain-cl-delta:yes
   compression:   zlib
   compression-level: default
@@ -252,6 +272,7 @@
   generaldelta:   noyes yes
   sparserevlog:   noyes yes
   sidedata:   no no  no
+  copies-sdc: no no  no
   plain-cl-delta:yesyes yes
   compression:   zlib   zlibzlib
   compression-level: default default default
@@ -262,6 +283,7 @@
   generaldelta:   no no yes
   sparserevlog:   no no yes
   sidedata:   no no  no
+  copies-sdc: no no  no
   plain-cl-delta:yesyes yes
   compression:   zlib   zlibzlib
   compression-level: default default default
@@ -272,6 +294,7 @@
   [formatvariant.name.mismatchdefault|generaldelta: 
][formatvariant.repo.mismatchdefault|  no][formatvariant.config.special| 
no][formatvariant.default| yes]
   [formatvariant.name.mismatchdefault|sparserevlog: 
][formatvariant.repo.mismatchdefault|  no][formatvariant.config.special| 
no][formatvariant.default| 

D6945: sidedatacopies: add a new requirement for storing copies into sidedata

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHG5f95ad19482a: sidedatacopies: add a new requirement for 
storing copies into sidedata (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6945?vs=16949=17000

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6945/new/

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -440,6 +440,10 @@
 # information for revision without altering their original hashes.
 SIDEDATA_REQUIREMENT = b'exp-sidedata-flag'
 
+# A repository with the the copies-sidedata-changeset requirement will store
+# copies related information in changeset's sidedata.
+COPIESSDC_REQUIREMENT = b'exp-copies-sidedata-changeset'
+
 # Functions receiving (ui, features) that extensions can register to impact
 # the ability to load repositories with custom requirements. Only
 # functions defined in loaded extensions are called.
@@ -997,6 +1001,7 @@
 b'revlogv1',
 b'generaldelta',
 b'treemanifest',
+COPIESSDC_REQUIREMENT,
 REVLOGV2_REQUIREMENT,
 SIDEDATA_REQUIREMENT,
 SPARSEREVLOG_REQUIREMENT,
@@ -3512,6 +3517,10 @@
 # experimental config: format.use-side-data
 if ui.configbool(b'format', b'use-side-data'):
 requirements.add(SIDEDATA_REQUIREMENT)
+# experimental config: format.exp-use-copies-side-data-changeset
+if ui.configbool(b'format', b'exp-use-copies-side-data-changeset'):
+requirements.add(SIDEDATA_REQUIREMENT)
+requirements.add(COPIESSDC_REQUIREMENT)
 if ui.configbool(b'experimental', b'treemanifest'):
 requirements.add(b'treemanifest')
 
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -748,6 +748,12 @@
 b'format', b'usestore', default=True,
 )
 coreconfigitem(
+b'format',
+b'exp-use-copies-side-data-changeset',
+default=False,
+experimental=True,
+)
+coreconfigitem(
 b'format', b'use-side-data', default=False, experimental=True,
 )
 coreconfigitem(



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


D6949: sidedatacopies: introduce a sidedata testcase for test-copies-in-changeset.t

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHG5a790eac6b1e: sidedatacopies: introduce a sidedata testcase 
for test-copies-in-changeset.t (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6949?vs=16781=17004

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6949/new/

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

AFFECTED FILES
  tests/test-copies-in-changeset.t

CHANGE DETAILS

diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t
--- a/tests/test-copies-in-changeset.t
+++ b/tests/test-copies-in-changeset.t
@@ -1,4 +1,6 @@
+#testcases extra sidedata
 
+#if extra
   $ cat >> $HGRCPATH << EOF
   > [experimental]
   > copies.write-to=changeset-only
@@ -7,6 +9,18 @@
   > changesetcopies = log -r . -T 'files: {files}
   >   {extras % "{ifcontains("files", key, "{key}: {value}\n")}"}
   >   {extras % "{ifcontains("copies", key, "{key}: {value}\n")}"}'
+  > EOF
+#endif
+
+#if sidedata
+  $ cat >> $HGRCPATH << EOF
+  > [format]
+  > exp-use-copies-side-data-changeset = yes
+  > EOF
+#endif
+
+  $ cat >> $HGRCPATH << EOF
+  > [alias]
   > showcopies = log -r . -T '{file_copies % "{source} -> {name}\n"}'
   > [extensions]
   > rebase =
@@ -17,6 +31,31 @@
 
   $ hg init repo
   $ cd repo
+#if sidedata
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:  yesyes  no
+  copies-sdc:yesyes  no
+  plain-cl-delta:yesyes yes
+  compression:   zlib   zlibzlib
+  compression-level: default default default
+#else
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:   no no  no
+  copies-sdc: no no  no
+  plain-cl-delta:yesyes yes
+  compression:   zlib   zlibzlib
+  compression-level: default default default
+#endif
   $ echo a > a
   $ hg add a
   $ hg ci -m initial
@@ -24,6 +63,9 @@
   $ hg cp a c
   $ hg cp a d
   $ hg ci -m 'copy a to b, c, and d'
+
+#if extra
+
   $ hg changesetcopies
   files: b c d
   filesadded: 0
@@ -33,29 +75,44 @@
   p1copies: 0\x00a (esc)
   1\x00a (esc)
   2\x00a (esc)
+
+#endif
+
   $ hg showcopies
   a -> b
   a -> c
   a -> d
+
+#if extra
+
   $ hg showcopies --config experimental.copies.read-from=compatibility
   a -> b
   a -> c
   a -> d
   $ hg showcopies --config experimental.copies.read-from=filelog-only
 
+#endif
+
 Check that renames are recorded correctly
 
   $ hg mv b b2
   $ hg ci -m 'rename b to b2'
+
+#if extra
+
   $ hg changesetcopies
   files: b b2
   filesadded: 1
   filesremoved: 0
   
   p1copies: 1\x00b (esc)
+
+#endif
+
   $ hg showcopies
   b -> b2
 
+
 Rename onto existing file. This should get recorded in the changeset files 
list and in the extras,
 even though there is no filelog entry.
 
@@ -63,20 +120,51 @@
   $ hg st --copies
   M c
 b2
+
+#if extra
+
   $ hg debugindex c
  rev linkrev nodeid   p1   p2
0   1 b789fdd96dc2  
+
+#else
+
+  $ hg debugindex c
+ rev linkrev nodeid   p1   p2
+   0   1 37d9b5d994ea  
+
+#endif
+
+
   $ hg ci -m 'move b onto d'
+
+#if extra
+
   $ hg changesetcopies
   files: c
   
   p1copies: 0\x00b2 (esc)
+
+#endif
+
   $ hg showcopies
   b2 -> c
+
+#if extra
+
   $ hg debugindex c
  rev linkrev nodeid   p1   p2
0   1 b789fdd96dc2  
 
+#else
+
+  $ hg debugindex c
+ rev linkrev nodeid   p1   p2
+   0   1 37d9b5d994ea  
+   1   3 029625640347  
+
+#endif
+
 Create a merge commit with copying done during merge.
 
   $ hg co 0
@@ -96,6 +184,9 @@
 File 'f' exists only in p1, so 'i' should be from p1
   $ hg cp f i
   $ hg ci -m 'merge'
+
+#if extra
+
   $ hg changesetcopies
   files: g h i
   filesadded: 0
@@ -105,6 +196,9 @@
   p1copies: 0\x00a (esc)
   2\x00f (esc)
   p2copies: 1\x00d (esc)
+
+#endif
+
   $ hg showcopies
   a -> g
   d -> h
@@ -113,6 +207,7 @@
 Test writing to both changeset and filelog
 
   $ hg cp a j
+#if extra
   $ hg ci -m 'copy a to j' --config experimental.copies.write-to=compatibility
   $ hg changesetcopies
   files: j
@@ -121,6 +216,9 @@
   
   p1copies: 0\x00a (esc)
   p2copies: 
+#else
+  $ hg ci -m 'copy a to j'
+#endif
   $ hg debugdata j 0
   \x01 (esc)
   copy: a
@@ -135,17 +233,23 @@
   a -> j
 Existing copy information in the changeset gets removed on amend and 

D6948: sidedatacopies: introduce a sidedata testcase for test-copies-unrelated.t

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHGacdddf0a7a5b: sidedatacopies: introduce a sidedata testcase 
for test-copies-unrelated.t (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6948?vs=16780=17003

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6948/new/

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

AFFECTED FILES
  tests/test-copies-unrelated.t

CHANGE DETAILS

diff --git a/tests/test-copies-unrelated.t b/tests/test-copies-unrelated.t
--- a/tests/test-copies-unrelated.t
+++ b/tests/test-copies-unrelated.t
@@ -1,4 +1,4 @@
-#testcases filelog compatibility changeset
+#testcases filelog compatibility changeset sidedata
 
   $ cat >> $HGRCPATH << EOF
   > [extensions]
@@ -22,6 +22,13 @@
   > EOF
 #endif
 
+#if sidedata
+  $ cat >> $HGRCPATH << EOF
+  > [format]
+  > exp-use-copies-side-data-changeset = yes
+  > EOF
+#endif
+
   $ REPONUM=0
   $ newrepo() {
   > cd $TESTTMP
@@ -172,8 +179,8 @@
   o  0 add x
  x
   $ hg debugpathcopies 0 5
-  x -> y (no-filelog !)
-#if no-filelog
+  x -> y (no-filelog no-sidedata !)
+#if no-filelog no-sidedata
   $ hg graft -r 2
   grafting 2:* "modify x again" (glob)
   merging y and x to y
@@ -340,8 +347,12 @@
   o  0 base
  a
   $ hg debugpathcopies 1 5
-  x -> y (no-filelog !)
-#if filelog
+  x -> y (no-filelog no-sidedata !)
+#if no-filelog no-sidedata
+  $ hg graft -r 2
+  grafting 2:* "modify x" (glob)
+  merging y and x to y
+#else
 BROKEN: This should succeed and merge the changes from x into y
   $ hg graft -r 2
   grafting 2:* "modify x" (glob)
@@ -351,10 +362,6 @@
   abort: unresolved conflicts, can't continue
   (use 'hg resolve' and 'hg graft --continue')
   [255]
-#else
-  $ hg graft -r 2
-  grafting 2:* "modify x" (glob)
-  merging y and x to y
 #endif
   $ hg co -qC 2
 BROKEN: This should succeed and merge the changes from x into y



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


D6947: sidedatacopies: introduce a sidedata testcase for test-copies.t

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHGffb802948be7: sidedatacopies: introduce a sidedata testcase 
for test-copies.t (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6947?vs=16779=17002

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6947/new/

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

AFFECTED FILES
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -1,4 +1,4 @@
-#testcases filelog compatibility changeset
+#testcases filelog compatibility changeset sidedata
 
   $ cat >> $HGRCPATH << EOF
   > [extensions]
@@ -22,6 +22,13 @@
   > EOF
 #endif
 
+#if sidedata
+  $ cat >> $HGRCPATH << EOF
+  > [format]
+  > exp-use-copies-side-data-changeset = yes
+  > EOF
+#endif
+
   $ REPONUM=0
   $ newrepo() {
   > cd $TESTTMP
@@ -302,6 +309,7 @@
   x -> z
   $ hg debugpathcopies 0 2
   x -> z (filelog !)
+  x -> z (sidedata !)
 
 Copy file that exists on both sides of the merge, different content
   $ newrepo
@@ -395,7 +403,7 @@
   $ hg debugpathcopies 2 3
   y -> z
   $ hg debugpathcopies 1 3
-  y -> z (no-filelog !)
+  y -> z (no-filelog no-sidedata !)
 
 Create x and y, then rename x to z on one side of merge, and rename y to z and
 modify z on the other side. When storing copies in the changeset, we don't
@@ -440,17 +448,18 @@
   o  0 add x and y
  x y
   $ hg debugpathcopies 1 4
-  y -> z (no-filelog !)
+  y -> z (no-filelog no-sidedata !)
   $ hg debugpathcopies 2 4
-  x -> z (no-filelog !)
+  x -> z (no-filelog no-sidedata !)
   $ hg debugpathcopies 0 4
   x -> z (filelog !)
+  x -> z (sidedata !)
   y -> z (compatibility !)
   y -> z (changeset !)
   $ hg debugpathcopies 1 5
-  y -> z (no-filelog !)
+  y -> z (no-filelog no-sidedata !)
   $ hg debugpathcopies 2 5
-  x -> z (no-filelog !)
+  x -> z (no-filelog no-sidedata !)
   $ hg debugpathcopies 0 5
   x -> z
 



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


D6953: sidedatacopies: read rename information from sidedata

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> changelog.py:369-371
> +if rawindices is not None:
> +rawindices = decodefileindices(self.files, rawindices)
> +return rawindices

Calling the list of filenames `rawindices` is misleading. I see that you've 
changed this code to return an empty list of files when the list of indices was 
itself an empty list. That makes sense. Could you extract that to a separate 
patch ? Does it matter in practice for sidedata? Please explain in the commit 
message if it does. That patch would also assign the decoded list of indices to 
a variable called `files` or something like that.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6953/new/

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

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


D6951: sidedatacopies: get and store sidedata in the changelogrevision object

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> marmoute wrote in changelog.py:618-624
> Is a followup good enough for you ?

Yes, even leaving it inconsistent is good enough for me :) I don't care that 
much

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6951/new/

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

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


D6952: sidedatacopies: preindent some copies related code

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute added a comment.


  In D6952#103223 , @martinvonz 
wrote:
  
  > I personally don't think this type of patch is needed -- Phabricator makes 
it very readable anyway (and there is `hg diff --ignore-space-change` for 
others). I'm sure some people disagree with me.
  
  I find it useful in my workflow, so I would rather keep it if you don't mind.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6952/new/

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

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


D6951: sidedatacopies: get and store sidedata in the changelogrevision object

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute added inline comments.

INLINE COMMENTS

> martinvonz wrote in changelog.py:618-624
> nit: inconsistent way of calling the `changelogrevision` constructor between 
> these two call sites

Is a followup good enough for you ?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6951/new/

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

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


D6952: sidedatacopies: preindent some copies related code

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  I personally don't think this type of patch is needed -- Phabricator makes it 
very readable anyway (and there is `hg diff --ignore-space-change` for others). 
I'm sure some people disagree with me.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6952/new/

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

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


D6951: sidedatacopies: get and store sidedata in the changelogrevision object

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> changelog.py:618-624
> +c = changelogrevision(*self._revisiondata(node))
>  return (c.manifest, c.user, c.date, c.files, c.description, c.extra)
>  
>  def changelogrevision(self, nodeorrev):
>  """Obtain a ``changelogrevision`` for a node or revision."""
> -return changelogrevision(self.revision(nodeorrev))
> +text, sidedata = self._revisiondata(nodeorrev)
> +return changelogrevision(text, sidedata)

nit: inconsistent way of calling the `changelogrevision` constructor between 
these two call sites

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6951/new/

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

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


D7035: test: fix a comment in test-side-data.t

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Small sentence adjustement.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-sidedata.t

CHANGE DETAILS

diff --git a/tests/test-sidedata.t b/tests/test-sidedata.t
--- a/tests/test-sidedata.t
+++ b/tests/test-sidedata.t
@@ -71,8 +71,8 @@
   compression-level: default default default
   $ hg debugupgraderepo -R up-no-side-data --config format.use-side-data=yes > 
/dev/null
 
-Check that we can downgrade to sidedata
--
+Check that we can downgrade from sidedata
+-
 
   $ hg init up-side-data --config format.use-side-data=yes
   $ hg debugformat -v -R up-side-data



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


D6944: debugsidedata: small doc improvement

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHGadc6bebfd08e: debugsidedata: small doc improvement 
(authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6944?vs=16948=16998

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6944/new/

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

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -3236,7 +3236,9 @@
 
 @command(b'debugsidedata', cmdutil.debugrevlogopts, _(b'-c|-m|FILE REV'))
 def debugsidedata(ui, repo, file_, rev=None, **opts):
-"""dump the side data for a cl/manifest/file revision"""
+"""dump the side data for a cl/manifest/file revision
+
+Use --verbose to dump the sidedata content."""
 opts = pycompat.byteskwargs(opts)
 if opts.get(b'changelog') or opts.get(b'manifest') or opts.get(b'dir'):
 if rev is not None:



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


D6939: sidedata: apply basic but tight security around exchange

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHGc17a63eb5d4c: sidedata: apply basic but tight security 
around exchange (authored by marmoute).
marmoute marked an inline comment as done.
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6939?vs=16943=16993

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6939/new/

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

AFFECTED FILES
  mercurial/bundle2.py
  mercurial/exchange.py

CHANGE DETAILS

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1049,6 +1049,8 @@
 cgpart.addparam(b'version', version)
 if b'treemanifest' in pushop.repo.requirements:
 cgpart.addparam(b'treemanifest', b'1')
+if b'exp-sidedata-flag' in pushop.repo.requirements:
+cgpart.addparam(b'exp-sidedata', b'1')
 
 def handlereply(op):
 """extract addchangegroup returns from server reply"""
@@ -2511,6 +2513,9 @@
 if b'treemanifest' in repo.requirements:
 part.addparam(b'treemanifest', b'1')
 
+if b'exp-sidedata-flag' in repo.requirements:
+part.addparam(b'exp-sidedata', b'1')
+
 if (
 kwargs.get(r'narrow', False)
 and kwargs.get(r'narrow_acl', False)
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1711,6 +1711,8 @@
 part.addparam(
 b'targetphase', b'%d' % phases.secret, mandatory=False
 )
+if b'exp-sidedata-flag' in repo.requirements:
+part.addparam(b'exp-sidedata', b'1')
 
 if opts.get(b'streamv2', False):
 addpartbundlestream2(bundler, repo, stream=True)
@@ -1930,7 +1932,14 @@
 
 
 @parthandler(
-b'changegroup', (b'version', b'nbchanges', b'treemanifest', b'targetphase')
+b'changegroup',
+(
+b'version',
+b'nbchanges',
+b'exp-sidedata',
+b'treemanifest',
+b'targetphase',
+),
 )
 def handlechangegroup(op, inpart):
 """apply a changegroup part on the repo
@@ -1965,6 +1974,14 @@
 op.repo.ui, op.repo.requirements, op.repo.features
 )
 op.repo._writerequirements()
+
+bundlesidedata = bool(b'exp-sidedata' in inpart.params)
+reposidedata = bool(b'exp-sidedata-flag' in op.repo.requirements)
+if reposidedata and not bundlesidedata:
+msg = b"repository is using sidedata but the bundle source do not"
+hint = b'this is currently unsupported'
+raise error.Abort(msg, hint=hint)
+
 extrakwargs = {}
 targetphase = inpart.params.get(b'targetphase')
 if targetphase is not None:
@@ -2551,5 +2568,7 @@
 part.addparam(b'version', cgversion)
 if b'treemanifest' in repo.requirements:
 part.addparam(b'treemanifest', b'1')
+if b'exp-sidedata-flag' in repo.requirements:
+part.addparam(b'exp-sidedata', b'1')
 
 return bundler



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


D6943: upgrade: allow for `sidedata` removal

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHG1b4fd93cd79a: upgrade: allow for `sidedata` removal 
(authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D6943?vs=16992=16997#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6943?vs=16992=16997

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6943/new/

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

AFFECTED FILES
  mercurial/upgrade.py
  tests/test-sidedata.t
  tests/test-upgrade-repo.t

CHANGE DETAILS

diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
--- a/tests/test-upgrade-repo.t
+++ b/tests/test-upgrade-repo.t
@@ -1361,3 +1361,53 @@
entry-0001 size 4
entry-0002 size 32
 
+downgrade
+
+  $ hg debugupgraderepo --config format.use-side-data=no --run --no-backup > 
/dev/null
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:   no no  no
+  plain-cl-delta:yesyes yes
+  compression:   zstd   zstdzlib
+  compression-level: default default default
+  $ cat .hg/requires
+  dotencode
+  fncache
+  generaldelta
+  revlog-compression-zstd
+  revlogv1
+  sparserevlog
+  store
+  $ hg debugsidedata -c 0
+
+upgrade from hgrc
+
+  $ cat >> .hg/hgrc << EOF
+  > [format]
+  > use-side-data=yes
+  > EOF
+  $ hg debugupgraderepo --run --no-backup > /dev/null
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:  yesyes  no
+  plain-cl-delta:yesyes yes
+  compression:   zstd   zstdzlib
+  compression-level: default default default
+  $ cat .hg/requires
+  dotencode
+  exp-sidedata-flag
+  fncache
+  generaldelta
+  revlog-compression-zstd
+  revlogv1
+  sparserevlog
+  store
+  $ hg debugsidedata -c 0
diff --git a/tests/test-sidedata.t b/tests/test-sidedata.t
--- a/tests/test-sidedata.t
+++ b/tests/test-sidedata.t
@@ -71,8 +71,8 @@
   compression-level: default default default
   $ hg debugupgraderepo -R up-no-side-data --config format.use-side-data=yes > 
/dev/null
 
-Check that we cannot upgrade to sidedata
-
+Check that we can downgrade to sidedata
+-
 
   $ hg init up-side-data --config format.use-side-data=yes
   $ hg debugformat -v -R up-side-data
@@ -95,6 +95,4 @@
   plain-cl-delta:yesyes yes
   compression:   zlib   zlibzlib
   compression-level: default default default
-  $ hg debugupgraderepo -R up-side-data --config format.use-side-data=no
-  abort: cannot upgrade repository; requirement would be removed: 
exp-sidedata-flag
-  [255]
+  $ hg debugupgraderepo -R up-side-data --config format.use-side-data=no > 
/dev/null
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -76,6 +76,7 @@
 """
 supported = {
 localrepo.SPARSEREVLOG_REQUIREMENT,
+localrepo.SIDEDATA_REQUIREMENT,
 }
 for name in compression.compengines:
 engine = compression.compengines[name]
@@ -679,8 +680,18 @@
 )
 
 
-def getsidedatacompanion(srcrepo, destrepo):
-return None
+def getsidedatacompanion(srcrepo, dstrepo):
+sidedatacompanion = None
+removedreqs = srcrepo.requirements - dstrepo.requirements
+if localrepo.SIDEDATA_REQUIREMENT in removedreqs:
+
+def sidedatacompanion(rl, rev):
+rl = getattr(rl, '_revlog', rl)
+if rl.flags(rev) & revlog.REVIDX_SIDEDATA:
+return True, (), {}
+return False, (), {}
+
+return sidedatacompanion
 
 
 def matchrevlog(revlogfilter, entry):



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


D6942: upgrade: allow upgrade to repository using sidedata

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHG75ad8af9c95e: upgrade: allow upgrade to repository using 
sidedata (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6942?vs=16946=16996

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6942/new/

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

AFFECTED FILES
  mercurial/upgrade.py
  tests/test-sidedata.t
  tests/test-upgrade-repo.t
  tests/testlib/ext-sidedata.py

CHANGE DETAILS

diff --git a/tests/testlib/ext-sidedata.py b/tests/testlib/ext-sidedata.py
--- a/tests/testlib/ext-sidedata.py
+++ b/tests/testlib/ext-sidedata.py
@@ -12,8 +12,10 @@
 
 from mercurial import (
 extensions,
+localrepo,
 node,
 revlog,
+upgrade,
 )
 
 from mercurial.revlogutils import sidedata
@@ -36,6 +38,8 @@
 
 def wraprevision(orig, self, nodeorrev, *args, **kwargs):
 text = orig(self, nodeorrev, *args, **kwargs)
+if getattr(self, 'sidedatanocheck', False):
+return text
 if nodeorrev != node.nullrev and nodeorrev != node.nullid:
 sd = self.sidedata(nodeorrev)
 if len(text) != struct.unpack('>I', sd[sidedata.SD_TEST1])[0]:
@@ -47,6 +51,33 @@
 return text
 
 
+def wrapgetsidedatacompanion(orig, srcrepo, dstrepo):
+sidedatacompanion = orig(srcrepo, dstrepo)
+addedreqs = dstrepo.requirements - srcrepo.requirements
+if localrepo.SIDEDATA_REQUIREMENT in addedreqs:
+assert sidedatacompanion is None  # deal with composition later
+
+def sidedatacompanion(revlog, rev):
+update = {}
+revlog.sidedatanocheck = True
+try:
+text = revlog.revision(rev)
+finally:
+del revlog.sidedatanocheck
+## let's store some arbitrary data just for testing
+# text length
+update[sidedata.SD_TEST1] = struct.pack('>I', len(text))
+# and sha2 hashes
+sha256 = hashlib.sha256(text).digest()
+update[sidedata.SD_TEST2] = struct.pack('>32s', sha256)
+return False, (), update
+
+return sidedatacompanion
+
+
 def extsetup(ui):
 extensions.wrapfunction(revlog.revlog, 'addrevision', wrapaddrevision)
 extensions.wrapfunction(revlog.revlog, 'revision', wraprevision)
+extensions.wrapfunction(
+upgrade, 'getsidedatacompanion', wrapgetsidedatacompanion
+)
diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
--- a/tests/test-upgrade-repo.t
+++ b/tests/test-upgrade-repo.t
@@ -1329,6 +1329,35 @@
   sparserevlog
   store
 
-  $ cd ..
+#endif
+
+Check upgrading to a side-data revlog
+-
+
+upgrade
 
-#endif
+  $ hg --config format.use-side-data=yes debugupgraderepo --run  --no-backup 
--config "extensions.sidedata=$TESTDIR/testlib/ext-sidedata.py" >/dev/null
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:  yes no  no
+  plain-cl-delta:yesyes yes
+  compression:   zstd   zstdzlib
+  compression-level: default default default
+  $ cat .hg/requires
+  dotencode
+  exp-sidedata-flag
+  fncache
+  generaldelta
+  revlog-compression-zstd
+  revlogv1
+  sparserevlog
+  store
+  $ hg debugsidedata -c 0
+  2 sidedata entries
+   entry-0001 size 4
+   entry-0002 size 32
+
diff --git a/tests/test-sidedata.t b/tests/test-sidedata.t
--- a/tests/test-sidedata.t
+++ b/tests/test-sidedata.t
@@ -45,8 +45,8 @@
 
 Right now, sidedata has not upgrade support
 
-Check that we cannot upgrade to sidedata
-
+Check that we can upgrade to sidedata
+-
 
   $ hg init up-no-side-data --config format.use-side-data=no
   $ hg debugformat -v -R up-no-side-data
@@ -69,9 +69,7 @@
   plain-cl-delta:yesyes yes
   compression:   zlib   zlibzlib
   compression-level: default default default
-  $ hg debugupgraderepo -R up-no-side-data --config format.use-side-data=yes
-  abort: cannot upgrade repository; do not support adding requirement: 
exp-sidedata-flag
-  [255]
+  $ hg debugupgraderepo -R up-no-side-data --config format.use-side-data=yes > 
/dev/null
 
 Check that we cannot upgrade to sidedata
 
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -31,6 +31,7 @@
 RECLONES_REQUIREMENTS = {
 b'generaldelta',
 localrepo.SPARSEREVLOG_REQUIREMENT,
+localrepo.SIDEDATA_REQUIREMENT,
 }
 
 
@@ -100,6 +101,7 @@
 b'revlogv1',
 b'store',
 localrepo.SPARSEREVLOG_REQUIREMENT,
+

D6941: revlog: add a way to control sidedata changes during revlog.clone

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHG3de4d13f22be: revlog: add a way to control sidedata changes 
during revlog.clone (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6941?vs=16945=16995

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6941/new/

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2542,6 +2542,7 @@
 addrevisioncb=None,
 deltareuse=DELTAREUSESAMEREVS,
 forcedeltabothparents=None,
+sidedatacompanion=None,
 ):
 """Copy this revlog to another, possibly with format changes.
 
@@ -2583,6 +2584,20 @@
 In addition to the delta policy, the ``forcedeltabothparents``
 argument controls whether to force compute deltas against both parents
 for merges. By default, the current default is used.
+
+If not None, the `sidedatacompanion` is callable that accept two
+arguments:
+
+(srcrevlog, rev)
+
+and return a triplet that control changes to sidedata content from the
+old revision to the new clone result:
+
+(dropall, filterout, update)
+
+* if `dropall` is True, all sidedata should be dropped
+* `filterout` is a set of sidedata keys that should be dropped
+* `update` is a mapping of additionnal/new key -> value
 """
 if deltareuse not in self.DELTAREUSEALL:
 raise ValueError(
@@ -2617,7 +2632,12 @@
 destrevlog._deltabothparents = forcedeltabothparents or oldamd
 
 self._clone(
-tr, destrevlog, addrevisioncb, deltareuse, 
forcedeltabothparents
+tr,
+destrevlog,
+addrevisioncb,
+deltareuse,
+forcedeltabothparents,
+sidedatacompanion,
 )
 
 finally:
@@ -2626,7 +2646,13 @@
 destrevlog._deltabothparents = oldamd
 
 def _clone(
-self, tr, destrevlog, addrevisioncb, deltareuse, forcedeltabothparents
+self,
+tr,
+destrevlog,
+addrevisioncb,
+deltareuse,
+forcedeltabothparents,
+sidedatacompanion,
 ):
 """perform the core duty of `revlog.clone` after parameter 
processing"""
 deltacomputer = deltautil.deltacomputer(destrevlog)
@@ -2642,12 +2668,24 @@
 p2 = index[entry[6]][7]
 node = entry[7]
 
+sidedataactions = (False, [], {})
+if sidedatacompanion is not None:
+sidedataactions = sidedatacompanion(self, rev)
+
 # (Possibly) reuse the delta from the revlog if allowed and
 # the revlog chunk is a delta.
 cachedelta = None
 rawtext = None
-if deltareuse == self.DELTAREUSEFULLADD:
-text = self.revision(rev)
+if any(sidedataactions) or deltareuse == self.DELTAREUSEFULLADD:
+dropall, filterout, update = sidedataactions
+text, sidedata = self._revisiondata(rev)
+if dropall:
+sidedata = {}
+for key in filterout:
+sidedata.pop(key, None)
+sidedata.update(update)
+if not sidedata:
+sidedata = None
 destrevlog.addrevision(
 text,
 tr,
@@ -2658,6 +2696,7 @@
 node=node,
 flags=flags,
 deltacomputer=deltacomputer,
+sidedata=sidedata,
 )
 else:
 if destrevlog._lazydelta:



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


D6940: sidedata: use only changegroup3 if sidedata is in use

2019-10-09 Thread marmoute (Pierre-Yves David)
Closed by commit rHG8f807a83d53b: sidedata: use only changegroup3 if sidedata 
is in use (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6940?vs=16944=16994

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6940/new/

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

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
@@ -1479,6 +1479,11 @@
 #
 # (or even to push subset of history)
 needv03 = True
+if b'exp-sidedata-flag' in repo.requirements:
+needv03 = True
+# don't attempt to use 01/02 until we do sidedata cleaning
+versions.discard(b'01')
+versions.discard(b'02')
 if not needv03:
 versions.discard(b'03')
 return versions



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


D6943: upgrade: allow for `sidedata` removal

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 16992.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6943?vs=16989=16992

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6943/new/

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

AFFECTED FILES
  mercurial/upgrade.py
  tests/test-sidedata.t
  tests/test-upgrade-repo.t

CHANGE DETAILS

diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
--- a/tests/test-upgrade-repo.t
+++ b/tests/test-upgrade-repo.t
@@ -1361,3 +1361,53 @@
entry-0001 size 4
entry-0002 size 32
 
+downgrade
+
+  $ hg debugupgraderepo --config format.use-side-data=no --run --no-backup > 
/dev/null
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:   no no  no
+  plain-cl-delta:yesyes yes
+  compression:   zstd   zstdzlib
+  compression-level: default default default
+  $ cat .hg/requires
+  dotencode
+  fncache
+  generaldelta
+  revlog-compression-zstd
+  revlogv1
+  sparserevlog
+  store
+  $ hg debugsidedata -c 0
+
+upgrade from hgrc
+
+  $ cat >> .hg/hgrc << EOF
+  > [format]
+  > use-side-data=yes
+  > EOF
+  $ hg debugupgraderepo --run --no-backup > /dev/null
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:  yesyes  no
+  plain-cl-delta:yesyes yes
+  compression:   zstd   zstdzlib
+  compression-level: default default default
+  $ cat .hg/requires
+  dotencode
+  exp-sidedata-flag
+  fncache
+  generaldelta
+  revlog-compression-zstd
+  revlogv1
+  sparserevlog
+  store
+  $ hg debugsidedata -c 0
diff --git a/tests/test-sidedata.t b/tests/test-sidedata.t
--- a/tests/test-sidedata.t
+++ b/tests/test-sidedata.t
@@ -71,8 +71,8 @@
   compression-level: default default default
   $ hg debugupgraderepo -R up-no-side-data --config format.use-side-data=yes > 
/dev/null
 
-Check that we cannot upgrade to sidedata
-
+Check that we can downgrade from sidedata
+-
 
   $ hg init up-side-data --config format.use-side-data=yes
   $ hg debugformat -v -R up-side-data
@@ -95,6 +95,4 @@
   plain-cl-delta:yesyes yes
   compression:   zlib   zlibzlib
   compression-level: default default default
-  $ hg debugupgraderepo -R up-side-data --config format.use-side-data=no
-  abort: cannot upgrade repository; requirement would be removed: 
exp-sidedata-flag
-  [255]
+  $ hg debugupgraderepo -R up-side-data --config format.use-side-data=no > 
/dev/null
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -76,6 +76,7 @@
 """
 supported = {
 localrepo.SPARSEREVLOG_REQUIREMENT,
+localrepo.SIDEDATA_REQUIREMENT,
 }
 for name in compression.compengines:
 engine = compression.compengines[name]
@@ -679,8 +680,18 @@
 )
 
 
-def getsidedatacompanion(srcrepo, destrepo):
-return None
+def getsidedatacompanion(srcrepo, dstrepo):
+sidedatacompanion = None
+removedreqs = srcrepo.requirements - dstrepo.requirements
+if localrepo.SIDEDATA_REQUIREMENT in removedreqs:
+
+def sidedatacompanion(rl, rev):
+rl = getattr(rl, '_revlog', rl)
+if rl.flags(rev) & revlog.REVIDX_SIDEDATA:
+return True, (), {}
+return False, (), {}
+
+return sidedatacompanion
 
 
 def matchrevlog(revlogfilter, entry):



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


D7034: fuzz: new target to fuzz jsonescapeu8fast

2019-10-09 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This code just feels complicated enough we should go ahead and give it
  a dedicated fuzzer: we've found bugs in similar things before.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/fuzz/Makefile
  contrib/fuzz/jsonescapeu8fast.cc

CHANGE DETAILS

diff --git a/contrib/fuzz/jsonescapeu8fast.cc b/contrib/fuzz/jsonescapeu8fast.cc
new file mode 100644
--- /dev/null
+++ b/contrib/fuzz/jsonescapeu8fast.cc
@@ -0,0 +1,57 @@
+#include 
+#include 
+#include 
+#include 
+
+#include "pyutil.h"
+
+#include 
+#include 
+#include 
+
+extern "C" {
+
+static PyCodeObject *code;
+
+extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
+{
+contrib::initpy(*argv[0]);
+code = (PyCodeObject *)Py_CompileString(R"py(
+from parsers import jsonescapeu8fast
+
+try:
+jsonescapeu8fast(data, paranoid)
+except Exception as e:
+pass
+# uncomment this print if you're editing this Python code
+# to debug failures.
+# print(e)
+)py",
+"fuzzer", Py_file_input);
+if (!code) {
+  std::cerr << "failed to compile Python code!" << std::endl;
+}
+return 0;
+}
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
+{
+FuzzedDataProvider provider(Data, Size);
+bool paranoid = provider.ConsumeBool();
+std::string remainder = provider.ConsumeRemainingBytesAsString();
+
+PyObject *mtext =
+  PyBytes_FromStringAndSize((const char *)remainder.c_str(), 
remainder.size());
+PyObject *locals = PyDict_New();
+PyDict_SetItemString(locals, "data", mtext);
+PyDict_SetItemString(locals, "paranoid", paranoid ? Py_True : 
Py_False);
+PyObject *res = PyEval_EvalCode(code, contrib::pyglobals(), locals);
+if (!res) {
+PyErr_Print();
+}
+Py_XDECREF(res);
+Py_DECREF(locals);
+Py_DECREF(mtext);
+return 0; // Non-zero return values are reserved for future use.
+}
+}
diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -121,6 +121,14 @@
  -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \
  -o $$OUT/fncache_fuzzer
 
+jsonescapeu8fast_fuzzer: jsonescapeu8fast.cc manifest.o charencode.o parsers.o 
dirs.o pathencode.o revlog.o pyutil.o
+   $(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+ -Wno-register -Wno-macro-redefined \
+ -I../../mercurial jsonescapeu8fast.cc \
+ manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o 
pyutil.o \
+ -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \
+ -o $$OUT/jsonescapeu8fast_fuzzer
+
 manifest_corpus.zip:
python manifest_corpus.py $$OUT/manifest_fuzzer_seed_corpus.zip
 
@@ -171,6 +179,6 @@
  mpatch \
  xdiff
 
-oss-fuzz: bdiff_fuzzer mpatch_fuzzer mpatch_corpus.zip xdiff_fuzzer 
dirs_fuzzer fncache_fuzzer manifest_fuzzer manifest_corpus.zip revlog_fuzzer 
revlog_corpus.zip dirstate_fuzzer dirstate_corpus.zip fm1readmarkers_fuzzer 
fm1readmarkers_corpus.zip
+oss-fuzz: bdiff_fuzzer mpatch_fuzzer mpatch_corpus.zip xdiff_fuzzer 
dirs_fuzzer fncache_fuzzer jsonescapeu8fast_fuzzer manifest_fuzzer 
manifest_corpus.zip revlog_fuzzer revlog_corpus.zip dirstate_fuzzer 
dirstate_corpus.zip fm1readmarkers_fuzzer fm1readmarkers_corpus.zip
 
 .PHONY: all clean oss-fuzz



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


D7033: fuzz: new fuzzer for fncache-related functions

2019-10-09 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Not all of these are strictly fncache-related, but they all have th
  same signature and similar-enough behavior that we may as well fuzz
  them together. No obvious bugs for once, but these felt like they were
  just complicated enough to cover.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/fuzz/Makefile
  contrib/fuzz/fncache.cc

CHANGE DETAILS

diff --git a/contrib/fuzz/fncache.cc b/contrib/fuzz/fncache.cc
new file mode 100644
--- /dev/null
+++ b/contrib/fuzz/fncache.cc
@@ -0,0 +1,78 @@
+#include 
+#include 
+#include 
+#include 
+
+#include "pyutil.h"
+
+#include 
+#include 
+
+extern "C" {
+
+static PyCodeObject *code;
+
+extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
+{
+contrib::initpy(*argv[0]);
+code = (PyCodeObject *)Py_CompileString(R"py(
+from parsers import (
+isasciistr,
+asciilower,
+asciiupper,
+encodedir,
+pathencode,
+lowerencode,
+)
+
+try:
+for fn in (
+isasciistr,
+asciilower,
+asciiupper,
+encodedir,
+pathencode,
+lowerencode,
+):
+try:
+fn(data)
+except UnicodeDecodeError:
+pass  # some functions emit this exception
+except AttributeError:
+# pathencode needs hashlib, which fails to import because the time
+# module fails to import. We should try and fix that some day, but
+# for now we at least get coverage on non-hashencoded codepaths.
+if fn != pathencode:
+raise
+# uncomment this for debugging exceptions
+# except Exception as e:
+# raise Exception('%r: %r' % (fn, e))
+except Exception as e:
+pass
+# uncomment this print if you're editing this Python code
+# to debug failures.
+# print(e)
+)py",
+"fuzzer", Py_file_input);
+if (!code) {
+  std::cerr << "failed to compile Python code!" << std::endl;
+}
+return 0;
+}
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
+{
+PyObject *mtext =
+PyBytes_FromStringAndSize((const char *)Data, (Py_ssize_t)Size);
+PyObject *locals = PyDict_New();
+PyDict_SetItemString(locals, "data", mtext);
+PyObject *res = PyEval_EvalCode(code, contrib::pyglobals(), locals);
+if (!res) {
+PyErr_Print();
+}
+Py_XDECREF(res);
+Py_DECREF(locals);
+Py_DECREF(mtext);
+return 0; // Non-zero return values are reserved for future use.
+}
+}
diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -113,6 +113,14 @@
  -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \
  -o $$OUT/dirs_fuzzer
 
+fncache_fuzzer: fncache.cc manifest.o charencode.o parsers.o dirs.o 
pathencode.o revlog.o pyutil.o
+   $(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+ -Wno-register -Wno-macro-redefined \
+ -I../../mercurial fncache.cc \
+ manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o 
pyutil.o \
+ -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \
+ -o $$OUT/fncache_fuzzer
+
 manifest_corpus.zip:
python manifest_corpus.py $$OUT/manifest_fuzzer_seed_corpus.zip
 
@@ -163,6 +171,6 @@
  mpatch \
  xdiff
 
-oss-fuzz: bdiff_fuzzer mpatch_fuzzer mpatch_corpus.zip xdiff_fuzzer 
dirs_fuzzer manifest_fuzzer manifest_corpus.zip revlog_fuzzer revlog_corpus.zip 
dirstate_fuzzer dirstate_corpus.zip fm1readmarkers_fuzzer 
fm1readmarkers_corpus.zip
+oss-fuzz: bdiff_fuzzer mpatch_fuzzer mpatch_corpus.zip xdiff_fuzzer 
dirs_fuzzer fncache_fuzzer manifest_fuzzer manifest_corpus.zip revlog_fuzzer 
revlog_corpus.zip dirstate_fuzzer dirstate_corpus.zip fm1readmarkers_fuzzer 
fm1readmarkers_corpus.zip
 
 .PHONY: all clean oss-fuzz



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


mercurial@43117: 7 new changesets

2019-10-09 Thread Mercurial Commits
7 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/e5d535621ee1
changeset:   43111:e5d535621ee1
user:Augie Fackler 
date:Tue Oct 08 13:38:02 2019 -0400
summary: infinitepush: mark extension as likely to be deleted

https://www.mercurial-scm.org/repo/hg/rev/24a07347aa60
changeset:   43112:24a07347aa60
user:Gregory Szorc 
date:Fri Feb 02 10:13:42 2018 -0800
summary: check-commit: allow foo_bar naming in functions

https://www.mercurial-scm.org/repo/hg/rev/37af48031d6f
changeset:   43113:37af48031d6f
user:Kyle Lippincott 
date:Tue Oct 08 10:40:36 2019 -0700
summary: hghave: document format for version feature checks as 
, no dots

https://www.mercurial-scm.org/repo/hg/rev/8197b395710e
changeset:   43114:8197b395710e
user:Kyle Lippincott 
date:Tue Oct 08 19:35:30 2019 -0700
summary: destutil: provide hint on rebase+merge for how to specify 
destination/rev

https://www.mercurial-scm.org/repo/hg/rev/4aa72cdf616f
changeset:   43115:4aa72cdf616f
user:Martin von Zweigbergk 
date:Sun Oct 06 20:17:41 2019 -0700
summary: py3: delete b'' prefix from safehasattr arguments

https://www.mercurial-scm.org/repo/hg/rev/defabf63e969
changeset:   43116:defabf63e969
user:Martin von Zweigbergk 
date:Tue Oct 08 15:15:37 2019 -0700
summary: debugcommands: add a few more writenoi18n()

https://www.mercurial-scm.org/repo/hg/rev/8ff1ecfadcd1
changeset:   43117:8ff1ecfadcd1
bookmark:@
tag: tip
user:Martin von Zweigbergk 
date:Tue Oct 08 15:06:18 2019 -0700
summary: cleanup: join string literals that are already on one line

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


D6943: upgrade: allow for `sidedata` removal

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute marked an inline comment as done.
marmoute updated this revision to Diff 16989.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6943?vs=16947=16989

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6943/new/

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

AFFECTED FILES
  mercurial/upgrade.py
  tests/test-sidedata.t
  tests/test-upgrade-repo.t

CHANGE DETAILS

diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
--- a/tests/test-upgrade-repo.t
+++ b/tests/test-upgrade-repo.t
@@ -1361,3 +1361,53 @@
entry-0001 size 4
entry-0002 size 32
 
+downgrade
+
+  $ hg debugupgraderepo --config format.use-side-data=no --run --no-backup > 
/dev/null
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:   no no  no
+  plain-cl-delta:yesyes yes
+  compression:   zstd   zstdzlib
+  compression-level: default default default
+  $ cat .hg/requires
+  dotencode
+  fncache
+  generaldelta
+  revlog-compression-zstd
+  revlogv1
+  sparserevlog
+  store
+  $ hg debugsidedata -c 0
+
+upgrade from hgrc
+
+  $ cat >> .hg/hgrc << EOF
+  > [format]
+  > use-side-data=yes
+  > EOF
+  $ hg debugupgraderepo --run --no-backup > /dev/null
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:  yesyes  no
+  plain-cl-delta:yesyes yes
+  compression:   zstd   zstdzlib
+  compression-level: default default default
+  $ cat .hg/requires
+  dotencode
+  exp-sidedata-flag
+  fncache
+  generaldelta
+  revlog-compression-zstd
+  revlogv1
+  sparserevlog
+  store
+  $ hg debugsidedata -c 0
diff --git a/tests/test-sidedata.t b/tests/test-sidedata.t
--- a/tests/test-sidedata.t
+++ b/tests/test-sidedata.t
@@ -71,8 +71,8 @@
   compression-level: default default default
   $ hg debugupgraderepo -R up-no-side-data --config format.use-side-data=yes > 
/dev/null
 
-Check that we cannot upgrade to sidedata
-
+Check that we can downgrade to sidedata
+-
 
   $ hg init up-side-data --config format.use-side-data=yes
   $ hg debugformat -v -R up-side-data
@@ -95,6 +95,4 @@
   plain-cl-delta:yesyes yes
   compression:   zlib   zlibzlib
   compression-level: default default default
-  $ hg debugupgraderepo -R up-side-data --config format.use-side-data=no
-  abort: cannot upgrade repository; requirement would be removed: 
exp-sidedata-flag
-  [255]
+  $ hg debugupgraderepo -R up-side-data --config format.use-side-data=no > 
/dev/null
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -76,6 +76,7 @@
 """
 supported = {
 localrepo.SPARSEREVLOG_REQUIREMENT,
+localrepo.SIDEDATA_REQUIREMENT,
 }
 for name in compression.compengines:
 engine = compression.compengines[name]
@@ -679,8 +680,18 @@
 )
 
 
-def getsidedatacompanion(srcrepo, destrepo):
-return None
+def getsidedatacompanion(srcrepo, dstrepo):
+sidedatacompanion = None
+removedreqs = srcrepo.requirements - dstrepo.requirements
+if localrepo.SIDEDATA_REQUIREMENT in removedreqs:
+
+def sidedatacompanion(rl, rev):
+rl = getattr(rl, '_revlog', rl)
+if rl.flags(rev) & revlog.REVIDX_SIDEDATA:
+return True, (), {}
+return False, (), {}
+
+return sidedatacompanion
 
 
 def matchrevlog(revlogfilter, entry):



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


D7025: rewriteutil: add configurable check to disallow obsoleting someone else cset

2019-10-09 Thread marmoute (Pierre-Yves David)
marmoute added a comment.


  This should probably be controled by a config option instead of a keyword 
argument to this function (we want the control of this to be unified)
  
  I would prefer a prompt than an abort.
  
  We talked about the pre-checking topic with Sushil on Sunday. The result of 
the discussion is synthetised in this plan page: 
https://www.mercurial-scm.org/wiki/CEDPrecheckPlan

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7025/new/

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

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


D7032: fuzz: exercise a little more revlog code

2019-10-09 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/D7032

AFFECTED FILES
  contrib/fuzz/revlog.cc

CHANGE DETAILS

diff --git a/contrib/fuzz/revlog.cc b/contrib/fuzz/revlog.cc
--- a/contrib/fuzz/revlog.cc
+++ b/contrib/fuzz/revlog.cc
@@ -20,17 +20,22 @@
 try:
 index, cache = parse_index2(data, inline)
 index.slicechunktodensity(list(range(len(index))), 0.5, 262144)
+index.stats()
+index.findsnapshots({}, 0)
+10 in index
 for rev in range(len(index)):
+index.reachableroots(0, [len(index)-1], [rev])
 node = index[rev][7]
 partial = index.shortest(node)
 index.partialmatch(node[:partial])
+index.deltachain(rev, None, True)
 except Exception as e:
 pass
 # uncomment this print if you're editing this Python code
 # to debug failures.
 # print e
 )py",
-   "fuzzer", Py_file_input);
+"fuzzer", Py_file_input);
return 0;
 }
 



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


D7031: fuzz: new fuzzer for dirs.c

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

REVISION SUMMARY
  This found a six-year-old bug immediately, and then I put it through a
  few CPU-days of time before sending it.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/fuzz/Makefile
  contrib/fuzz/dirs.cc

CHANGE DETAILS

diff --git a/contrib/fuzz/dirs.cc b/contrib/fuzz/dirs.cc
new file mode 100644
--- /dev/null
+++ b/contrib/fuzz/dirs.cc
@@ -0,0 +1,56 @@
+#include 
+#include 
+#include 
+#include 
+
+#include "pyutil.h"
+
+#include 
+
+extern "C" {
+
+static PyCodeObject *code;
+
+extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
+{
+contrib::initpy(*argv[0]);
+code = (PyCodeObject *)Py_CompileString(R"py(
+from parsers import dirs
+try:
+  files = mdata.split('\n')
+  d = dirs(files)
+  list(d)
+  'a' in d
+  if files:
+files[0] in d
+except Exception as e:
+  pass
+  # uncomment this print if you're editing this Python code
+  # to debug failures.
+  # print e
+)py",
+"fuzzer", Py_file_input);
+return 0;
+}
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
+{
+// Don't allow fuzzer inputs larger than 100k, since we'll just bog
+// down and not accomplish much.
+if (Size > 10) {
+return 0;
+}
+PyObject *mtext =
+PyBytes_FromStringAndSize((const char *)Data, (Py_ssize_t)Size);
+PyObject *locals = PyDict_New();
+PyDict_SetItemString(locals, "mdata", mtext);
+PyObject *res = PyEval_EvalCode(code, contrib::pyglobals(), locals);
+if (!res) {
+PyErr_Print();
+}
+Py_XDECREF(res);
+Py_DECREF(locals);
+Py_DECREF(mtext);
+return 0; // Non-zero return values are reserved for future use.
+}
+}
diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -105,6 +105,17 @@
  -I../../mercurial \
  -c -o revlog.o ../../mercurial/cext/revlog.c
 
+dirs_fuzzer: dirs.cc manifest.o charencode.o parsers.o dirs.o pathencode.o 
revlog.o pyutil.o
+   $(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+ -Wno-register -Wno-macro-redefined \
+ -I../../mercurial dirs.cc \
+ manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o 
pyutil.o \
+ -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \
+ -o $$OUT/dirs_fuzzer
+
+manifest_corpus.zip:
+   python manifest_corpus.py $$OUT/manifest_fuzzer_seed_corpus.zip
+
 manifest_fuzzer: manifest.cc manifest.o charencode.o parsers.o dirs.o 
pathencode.o revlog.o pyutil.o
$(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
  -Wno-register -Wno-macro-redefined \
@@ -113,9 +124,6 @@
  -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \
  -o $$OUT/manifest_fuzzer
 
-manifest_corpus.zip:
-   python manifest_corpus.py $$OUT/manifest_fuzzer_seed_corpus.zip
-
 revlog_fuzzer: revlog.cc manifest.o charencode.o parsers.o dirs.o pathencode.o 
revlog.o pyutil.o
$(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
  -Wno-register -Wno-macro-redefined \
@@ -155,6 +163,6 @@
  mpatch \
  xdiff
 
-oss-fuzz: bdiff_fuzzer mpatch_fuzzer mpatch_corpus.zip xdiff_fuzzer 
manifest_fuzzer manifest_corpus.zip revlog_fuzzer revlog_corpus.zip 
dirstate_fuzzer dirstate_corpus.zip fm1readmarkers_fuzzer 
fm1readmarkers_corpus.zip
+oss-fuzz: bdiff_fuzzer mpatch_fuzzer mpatch_corpus.zip xdiff_fuzzer 
dirs_fuzzer manifest_fuzzer manifest_corpus.zip revlog_fuzzer revlog_corpus.zip 
dirstate_fuzzer dirstate_corpus.zip fm1readmarkers_fuzzer 
fm1readmarkers_corpus.zip
 
 .PHONY: all clean oss-fuzz



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


D7030: dirs: fix trivial over-read of input data

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

REVISION SUMMARY
  This code, introduced in 8c0a7eeda06d 
, 
was intentionally over-reading
  an input string to avoid getting a shared string object for a one-byte
  input. Unfortunately with an empty input (like in the case of a fuzzer
  getting started) this was a trivial over-read and triggered an
  AddressSanitizer failure.
  
  I went out of my way to make sure the code still does the
  copy-avoidance tricks. I don't think this change will cost us much
  performance since the one-character strings should be cached
  aggressively anyway.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cext/dirs.c

CHANGE DETAILS

diff --git a/mercurial/cext/dirs.c b/mercurial/cext/dirs.c
--- a/mercurial/cext/dirs.c
+++ b/mercurial/cext/dirs.c
@@ -68,26 +68,41 @@
while ((pos = _finddir(cpath, pos - 1)) != -1) {
PyObject *val;
 
-   /* It's likely that every prefix already has an entry
-  in our dict. Try to avoid allocating and
-  deallocating a string for each prefix we check. */
-   if (key != NULL)
-   ((PyBytesObject *)key)->ob_shash = -1;
-   else {
-   /* Force Python to not reuse a small shared string. */
-   key = PyBytes_FromStringAndSize(cpath,
-pos < 2 ? 2 : pos);
+   if (pos < 2) {
+   key = PyBytes_FromStringAndSize(cpath, pos);
if (key == NULL)
goto bail;
+   } else {
+   /* It's likely that every prefix already has an entry
+  in our dict. Try to avoid allocating and
+  deallocating a string for each prefix we check. */
+   if (key != NULL)
+   ((PyBytesObject *)key)->ob_shash = -1;
+   else {
+   /* We know pos >= 2, so we won't get a small
+* shared string. */
+   key = PyBytes_FromStringAndSize(cpath, pos);
+   if (key == NULL)
+   goto bail;
+   }
+   /* Py_SIZE(o) refers to the ob_size member of
+* the struct. Yes, assigning to what looks
+* like a function seems wrong. */
+   Py_SIZE(key) = pos;
+   ((PyBytesObject *)key)->ob_sval[pos] = '\0';
}
-   /* Py_SIZE(o) refers to the ob_size member of the struct. Yes,
-   * assigning to what looks like a function seems wrong. */
-   Py_SIZE(key) = pos;
-   ((PyBytesObject *)key)->ob_sval[pos] = '\0';
 
val = PyDict_GetItem(dirs, key);
if (val != NULL) {
PYLONG_VALUE(val) += 1;
+   if (pos < 2) {
+   /* This was a short string, so we
+* probably got a small shared string
+* we can't mutate on the next loop
+* iteration. Clear it.
+*/
+   Py_CLEAR(key);
+   }
break;
}
 



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


Re: [PATCH 2 of 2] py3: flush ui after each message in interactive patch filtering

2019-10-09 Thread Pulkit Goyal
On Wed, Oct 9, 2019 at 4:42 PM Denis Laxalde  wrote:
>
> # HG changeset patch
> # User Denis Laxalde 
> # Date 1570627454 -7200
> #  Wed Oct 09 15:24:14 2019 +0200
> # Node ID 0cdeb24af4076eae433de3f63fda36da4e6fc0d0
> # Parent  99f06850be3ecc521ba461684686865c1191c5a0
> py3: flush ui after each message in interactive patch filtering
>
> Otherwise, actions from ui.write() are buffered and displayed at end of
> interactive session.

According to nbjoerg on IRC, it's better to flush before asking for
input instead of flushing after every write. Queued only 1.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 2] py3: flush ui after each message in interactive patch filtering

2019-10-09 Thread Yuya Nishihara
On Wed, 09 Oct 2019 15:29:24 +0200, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde 
> # Date 1570627454 -7200
> #  Wed Oct 09 15:24:14 2019 +0200
> # Node ID 0cdeb24af4076eae433de3f63fda36da4e6fc0d0
> # Parent  99f06850be3ecc521ba461684686865c1191c5a0
> py3: flush ui after each message in interactive patch filtering

Queued, thanks.

> Otherwise, actions from ui.write() are buffered and displayed at end of
> interactive session.

I suspect that "sys.stdout.buffer" isn't line-buffered on Python 3 even
though "sys.stdout" is documented as such. If that's true, we'll need another
hack to make our stdout do the right thing.

https://docs.python.org/3/library/sys.html#sys.stdout
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 2] py3: decode prompt string before calling rawinput

2019-10-09 Thread Pulkit Goyal
On Wed, Oct 9, 2019 at 4:38 PM Denis Laxalde  wrote:
>
> # HG changeset patch
> # User Denis Laxalde 
> # Date 1570627696 -7200
> #  Wed Oct 09 15:28:16 2019 +0200
> # Node ID 99f06850be3ecc521ba461684686865c1191c5a0
> # Parent  1fcf79e9943a17a2e7ae19954b2b5ad5972f8fff
> py3: decode prompt string before calling rawinput
>
> Calling input() (aka pycompat.rawinput() on python3) with a byte string
> displays a byte string in the console. E.g. in interactive commit, we
> get: b"examine changes to ''?\n(enter ? for help) [Ynesfdaq?]".
> Similarly, "hg email" prompts are messed up.
>
> We thus decode the prompt string before running rawinput().

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


Re: [PATCH 01 of 13] perf: document `perfstatus`

2019-10-09 Thread Pulkit Goyal
On Tue, Oct 8, 2019 at 8:16 PM Pierre-Yves David
 wrote:
>
> # HG changeset patch
> # User Pierre-Yves David 
> # Date 1570511728 14400
> #  Tue Oct 08 01:15:28 2019 -0400
> # Node ID 8d066f6d8a5716e88812487d7d1c7db2808bb9bb
> # Parent  9002f4a3dde63518d1467f3934a1fe226f3b2297
> # EXP-Topic perf-doc
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 8d066f6d8a57
> perf: document `perfstatus`

Queued 1-11, many thanks!

For 12, 13 I personally will like to unify/organize these
perfdirstate* commands much better and use flags there. I am not sure
that should be a blocker and hence I will leave it for others to have
a look.

(If we had subcommands, these might be more better organized)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 08 of 13] perf: document `perfdirfoldmap`

2019-10-09 Thread Pierre-Yves David

On 10/9/19 4:19 PM, Pulkit Goyal wrote:

On Tue, Oct 8, 2019 at 8:45 PM Pierre-Yves David
 wrote:


# HG changeset patch
# User Pierre-Yves David 
# Date 1570513758 14400
#  Tue Oct 08 01:49:18 2019 -0400
# Node ID 8a6ad5abbf29c925d1b2610714f9e68df1bbc8e1
# Parent  701f359a9899d1a8b2cafea2aadc1f667dacd385
# EXP-Topic perf-doc
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
8a6ad5abbf29
perf: document `perfdirfoldmap`

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1163,6 +1163,10 @@ def perfdirstatefoldmap(ui, repo, **opts

  @command(b'perfdirfoldmap', formatteropts)
  def perfdirfoldmap(ui, repo, **opts):
+"""benchmap a `dirstate._map.dirfoldmap.get()` request
+
+The dirstate dirfoldmap cache is dropped between every request.
+"""


Looks like we can merge `perdirfoldmap` and `perfdirstatefoldmap` and
have file and dir as flags.


Maybe ? Adding Raphaƫl in CC since he know more about theses.
I am just doing a simple cleanup pass here.

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


Re: [PATCH 08 of 13] perf: document `perfdirfoldmap`

2019-10-09 Thread Pulkit Goyal
On Tue, Oct 8, 2019 at 8:45 PM Pierre-Yves David
 wrote:
>
> # HG changeset patch
> # User Pierre-Yves David 
> # Date 1570513758 14400
> #  Tue Oct 08 01:49:18 2019 -0400
> # Node ID 8a6ad5abbf29c925d1b2610714f9e68df1bbc8e1
> # Parent  701f359a9899d1a8b2cafea2aadc1f667dacd385
> # EXP-Topic perf-doc
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 8a6ad5abbf29
> perf: document `perfdirfoldmap`
>
> diff --git a/contrib/perf.py b/contrib/perf.py
> --- a/contrib/perf.py
> +++ b/contrib/perf.py
> @@ -1163,6 +1163,10 @@ def perfdirstatefoldmap(ui, repo, **opts
>
>  @command(b'perfdirfoldmap', formatteropts)
>  def perfdirfoldmap(ui, repo, **opts):
> +"""benchmap a `dirstate._map.dirfoldmap.get()` request
> +
> +The dirstate dirfoldmap cache is dropped between every request.
> +"""

Looks like we can merge `perdirfoldmap` and `perfdirstatefoldmap` and
have file and dir as flags.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6987: strip: move strip extension to core as debugstrip

2019-10-09 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> strip.py:3
>  
> -This extension allows you to strip changesets and all their descendants from 
> the
> -repository. See the command help for details.
> +strip extension has been renamed to debugstrip and moved to core. However,
> +this extension is to preserve the old `strip` name forusers that are used

the documentation should be left as it is.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6987/new/

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

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


[PATCH 2 of 2] py3: flush ui after each message in interactive patch filtering

2019-10-09 Thread Denis Laxalde
# HG changeset patch
# User Denis Laxalde 
# Date 1570627454 -7200
#  Wed Oct 09 15:24:14 2019 +0200
# Node ID 0cdeb24af4076eae433de3f63fda36da4e6fc0d0
# Parent  99f06850be3ecc521ba461684686865c1191c5a0
py3: flush ui after each message in interactive patch filtering

Otherwise, actions from ui.write() are buffered and displayed at end of
interactive session.

diff --git a/mercurial/patch.py b/mercurial/patch.py
index 374d5d6..e27d0ca 100644
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -1188,9 +1188,11 @@ def filterpatch(ui, headers, match, oper
 # chars is a good target) because of issue6158.
 r = ui.promptchoice(b"%s\n(enter ? for help) %s" % (query, resps))
 ui.write(b"\n")
+ui.flush()
 if r == 8:  # ?
 for c, t in ui.extractchoices(resps)[1]:
 ui.write(b'%s - %s\n' % (c, encoding.lower(t)))
+ui.flush()
 continue
 elif r == 0:  # yes
 ret = True
@@ -1200,10 +1202,12 @@ def filterpatch(ui, headers, match, oper
 if chunk is None:
 ui.write(_(b'cannot edit patch for whole file'))
 ui.write(b"\n")
+ui.flush()
 continue
 if chunk.header.binary():
 ui.write(_(b'cannot edit patch for binary file'))
 ui.write(b"\n")
+ui.flush()
 continue
 # Patch comment based on the Git one (based on comment at end 
of
 # https://mercurial-scm.org/wiki/RecordExtension)
@@ -1304,6 +1308,7 @@ the hunk is left unchanged.
 for i, chunk in enumerate(h.hunks):
 if skipfile is None and skipall is None:
 chunk.pretty(ui)
+ui.flush()
 if total == 1:
 msg = messages[b'single'][operation] % chunk.filename()
 else:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2] py3: decode prompt string before calling rawinput

2019-10-09 Thread Denis Laxalde
# HG changeset patch
# User Denis Laxalde 
# Date 1570627696 -7200
#  Wed Oct 09 15:28:16 2019 +0200
# Node ID 99f06850be3ecc521ba461684686865c1191c5a0
# Parent  1fcf79e9943a17a2e7ae19954b2b5ad5972f8fff
py3: decode prompt string before calling rawinput

Calling input() (aka pycompat.rawinput() on python3) with a byte string
displays a byte string in the console. E.g. in interactive commit, we
get: b"examine changes to ''?\n(enter ? for help) [Ynesfdaq?]".
Similarly, "hg email" prompts are messed up.

We thus decode the prompt string before running rawinput().

diff --git a/mercurial/ui.py b/mercurial/ui.py
index b8cac79..432f53e 100644
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1555,6 +1555,7 @@ class ui(object):
 # - http://bugs.python.org/issue12833
 with self.timeblockedsection(b'stdio'):
 if usereadline:
+prompt = encoding.strfromlocal(prompt)
 line = encoding.strtolocal(pycompat.rawinput(prompt))
 # When stdin is in binary mode on Windows, it can cause
 # raw_input() to emit an extra trailing carriage return
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7029: py3: delete b'' prefix from safehasattr arguments

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHG4aa72cdf616f: py3: delete b prefix from 
safehasattr arguments (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7029?vs=16980=16983

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7029/new/

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

AFFECTED FILES
  hgext/absorb.py
  hgext/bugzilla.py
  hgext/commitextras.py
  hgext/fastannotate/commands.py
  hgext/fsmonitor/watchmanclient.py
  hgext/journal.py
  hgext/lfs/wireprotolfsserver.py
  hgext/narrow/narrowbundle2.py
  hgext/remotefilelog/connectionpool.py
  hgext/remotefilelog/fileserverclient.py
  hgext/remotefilelog/repack.py
  hgext/remotefilelog/shallowrepo.py
  mercurial/bundle2.py
  mercurial/bundlerepo.py
  mercurial/pvec.py
  mercurial/registrar.py
  mercurial/utils/procutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -259,8 +259,8 @@
 (portable, not much used).
 """
 return (
-pycompat.safehasattr(sys, b"frozen")
-or pycompat.safehasattr(sys, b"importers")  # new py2exe
+pycompat.safehasattr(sys, "frozen")
+or pycompat.safehasattr(sys, "importers")  # new py2exe
 or imp.is_frozen(r"__main__")  # old py2exe
 )  # tools/freeze
 
diff --git a/mercurial/registrar.py b/mercurial/registrar.py
--- a/mercurial/registrar.py
+++ b/mercurial/registrar.py
@@ -65,7 +65,7 @@
 msg = b'duplicate registration for name: "%s"' % name
 raise error.ProgrammingError(msg)
 
-if func.__doc__ and not util.safehasattr(func, b'_origdoc'):
+if func.__doc__ and not util.safehasattr(func, '_origdoc'):
 func._origdoc = func.__doc__.strip()
 doc = pycompat.sysbytes(func._origdoc)
 func.__doc__ = pycompat.sysstr(self._formatdoc(decl, doc))
diff --git a/mercurial/pvec.py b/mercurial/pvec.py
--- a/mercurial/pvec.py
+++ b/mercurial/pvec.py
@@ -159,7 +159,7 @@
 def ctxpvec(ctx):
 '''construct a pvec for ctx while filling in the cache'''
 r = ctx.repo()
-if not util.safehasattr(r, b"_pveccache"):
+if not util.safehasattr(r, "_pveccache"):
 r._pveccache = {}
 pvc = r._pveccache
 if ctx.rev() not in pvc:
diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -212,7 +212,7 @@
 class bundlephasecache(phases.phasecache):
 def __init__(self, *args, **kwargs):
 super(bundlephasecache, self).__init__(*args, **kwargs)
-if util.safehasattr(self, b'opener'):
+if util.safehasattr(self, 'opener'):
 self.opener = vfsmod.readonlyvfs(self.opener)
 
 def write(self):
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -936,7 +936,7 @@
 
 def close(self):
 """close underlying file"""
-if util.safehasattr(self._fp, b'close'):
+if util.safehasattr(self._fp, 'close'):
 return self._fp.close()
 
 
@@ -1024,7 +1024,7 @@
 
 The new part have the very same content but no partid assigned yet.
 Parts with generated data cannot be copied."""
-assert not util.safehasattr(self.data, b'next')
+assert not util.safehasattr(self.data, 'next')
 return self.__class__(
 self.type,
 self._mandatoryparams,
@@ -1093,7 +1093,7 @@
 msg.append(b')')
 if not self.data:
 msg.append(b' empty payload')
-elif util.safehasattr(self.data, b'next') or util.safehasattr(
+elif util.safehasattr(self.data, 'next') or util.safehasattr(
 self.data, b'__next__'
 ):
 msg.append(b' streamed payload')
@@ -1189,7 +1189,7 @@
 Exists to handle the different methods to provide data to a part."""
 # we only support fixed size data now.
 # This will be improved in the future.
-if util.safehasattr(self.data, b'next') or util.safehasattr(
+if util.safehasattr(self.data, 'next') or util.safehasattr(
 self.data, b'__next__'
 ):
 buff = util.chunkbuffer(self.data)
@@ -1336,7 +1336,7 @@
 
 def __init__(self, ui, header, fp):
 super(unbundlepart, self).__init__(fp)
-self._seekable = util.safehasattr(fp, b'seek') and util.safehasattr(
+self._seekable = util.safehasattr(fp, 'seek') and util.safehasattr(
 fp, b'tell'
 )
 self.ui = ui
diff --git a/hgext/remotefilelog/shallowrepo.py 
b/hgext/remotefilelog/shallowrepo.py
--- a/hgext/remotefilelog/shallowrepo.py
+++ b/hgext/remotefilelog/shallowrepo.py
@@ -345,7 +345,7 @@
 repo.excludepattern = repo.ui.configlist(
 b"remotefilelog", 

D7027: debugcommands: add a few more writenoi18n()

2019-10-09 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHGdefabf63e969: debugcommands: add a few more writenoi18n() 
(authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7027?vs=16978=16984

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7027/new/

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

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -2948,7 +2948,7 @@
 
 if format == 0:
 if ui.verbose:
-ui.write(
+ui.writenoi18n(
 (b"   revoffset  length linkrev" b" %s %s p2\n")
 % (b"nodeid".ljust(idlen), b"p1".ljust(idlen))
 )
@@ -2959,7 +2959,7 @@
 )
 elif format == 1:
 if ui.verbose:
-ui.write(
+ui.writenoi18n(
 (
 b"   rev flag   offset   length size   link p1"
 b" p2 %s\n"
@@ -3253,11 +3253,11 @@
 if sidedata:
 sidedata = list(sidedata.items())
 sidedata.sort()
-ui.write((b'%d sidedata entries\n' % len(sidedata)))
+ui.writenoi18n(b'%d sidedata entries\n' % len(sidedata))
 for key, value in sidedata:
-ui.write((b' entry-%04o size %d\n' % (key, len(value
+ui.writenoi18n(b' entry-%04o size %d\n' % (key, len(value)))
 if ui.verbose:
-ui.write((b'  %s\n' % stringutil.pprint(value)))
+ui.writenoi18n(b'  %s\n' % stringutil.pprint(value))
 
 
 @command(b'debugssl', [], b'[SOURCE]', optionalrepo=True)



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


[Bug 6199] New: i have problem when use hg update

2019-10-09 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6199

Bug ID: 6199
   Summary: i have problem when use hg update
   Product: Mercurial
   Version: unspecified
  Hardware: PC
OS: Windows
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: popu...@gmail.com
CC: mercurial-devel@mercurial-scm.org

$ hg up default -C
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64
bit (AMD64)]
** Mercurial Distributed SCM (version 5.0.2)
** Extensions loaded: strip
** ProgrammingError: unsupported changeid '' of type 
Traceback (most recent call last):
  File "hg", line 50, in 
  File "mercurial\dispatch.pyo", line 99, in run
  File "mercurial\dispatch.pyo", line 225, in dispatch
  File "mercurial\dispatch.pyo", line 376, in _runcatch
  File "mercurial\dispatch.pyo", line 384, in _callcatch
  File "mercurial\scmutil.pyo", line 167, in callcatch
  File "mercurial\dispatch.pyo", line 367, in _runcatchfunc
  File "mercurial\dispatch.pyo", line 1021, in _dispatch
  File "mercurial\dispatch.pyo", line 756, in runcommand
  File "mercurial\dispatch.pyo", line 1030, in _runcommand
  File "mercurial\dispatch.pyo", line 1018, in 
  File "mercurial\util.pyo", line 1680, in check
  File "mercurial\commands.pyo", line 6140, in update
  File "mercurial\hg.pyo", line 921, in updatetotally
  File "mercurial\hg.pyo", line 874, in clean
  File "mercurial\hg.pyo", line 859, in updaterepo
  File "mercurial\merge.pyo", line 2186, in update
  File "mercurial\merge.pyo", line 1674, in applyupdates
  File "mercurial\subrepoutil.pyo", line 224, in submerge
  File "mercurial\subrepo.pyo", line 74, in decoratedmethod
  File "mercurial\subrepo.pyo", line 691, in get
  File "mercurial\subrepo.pyo", line 629, in _get
  File "mercurial\localrepo.pyo", line 1396, in __contains__
  File "mercurial\localrepo.pyo", line 1376, in __getitem__
mercurial.error.ProgrammingError: unsupported changeid '' of type 

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