D2276: a: change a to add some new lines
khanchi97 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY So I have added some code to check how my patch will be look like. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2276 AFFECTED FILES a CHANGE DETAILS diff --git a/a b/a --- a/a +++ b/a @@ -1 +1,2 @@ -a +So it's very nice to see you! +Btw, I dont' have any idea about it. To: khanchi97, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2183: mpatch: allow clang-format oversight
This revision was automatically updated to reflect the committed changes. Closed by commit rHG782eecbcbc75: mpatch: allow clang-format oversight (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2183?vs=5750=5754 REVISION DETAIL https://phab.mercurial-scm.org/D2183 AFFECTED FILES contrib/clang-format-blacklist mercurial/cext/mpatch.c CHANGE DETAILS diff --git a/mercurial/cext/mpatch.c b/mercurial/cext/mpatch.c --- a/mercurial/cext/mpatch.c +++ b/mercurial/cext/mpatch.c @@ -55,10 +55,10 @@ ssize_t blen; int r; - PyObject *tmp = PyList_GetItem((PyObject*)bins, pos); + PyObject *tmp = PyList_GetItem((PyObject *)bins, pos); if (!tmp) return NULL; - if (PyObject_AsCharBuffer(tmp, , (Py_ssize_t*))) + if (PyObject_AsCharBuffer(tmp, , (Py_ssize_t *))) return NULL; if ((r = mpatch_decode(buffer, blen, )) < 0) { if (!PyErr_Occurred()) @@ -68,8 +68,7 @@ return res; } -static PyObject * -patches(PyObject *self, PyObject *args) +static PyObject *patches(PyObject *self, PyObject *args) { PyObject *text, *bins, *result; struct mpatch_flist *patch; @@ -123,8 +122,7 @@ } /* calculate size of a patched file directly */ -static PyObject * -patchedsize(PyObject *self, PyObject *args) +static PyObject *patchedsize(PyObject *self, PyObject *args) { long orig, start, end, len, outlen = 0, last = 0, pos = 0; Py_ssize_t patchlen; @@ -147,29 +145,26 @@ if (pos != patchlen) { if (!PyErr_Occurred()) - PyErr_SetString(mpatch_Error, "patch cannot be decoded"); + PyErr_SetString(mpatch_Error, + "patch cannot be decoded"); return NULL; } outlen += orig - last; return Py_BuildValue("l", outlen); } static PyMethodDef methods[] = { - {"patches", patches, METH_VARARGS, "apply a series of patches\n"}, - {"patchedsize", patchedsize, METH_VARARGS, "calculed patched size\n"}, - {NULL, NULL} +{"patches", patches, METH_VARARGS, "apply a series of patches\n"}, +{"patchedsize", patchedsize, METH_VARARGS, "calculed patched size\n"}, +{NULL, NULL}, }; static const int version = 1; #ifdef IS_PY3K static struct PyModuleDef mpatch_module = { - PyModuleDef_HEAD_INIT, - "mpatch", - mpatch_doc, - -1, - methods +PyModuleDef_HEAD_INIT, "mpatch", mpatch_doc, -1, methods, }; PyMODINIT_FUNC PyInit_mpatch(void) @@ -180,22 +175,21 @@ if (m == NULL) return NULL; - mpatch_Error = PyErr_NewException("mercurial.cext.mpatch.mpatchError", - NULL, NULL); + mpatch_Error = + PyErr_NewException("mercurial.cext.mpatch.mpatchError", NULL, NULL); Py_INCREF(mpatch_Error); PyModule_AddObject(m, "mpatchError", mpatch_Error); PyModule_AddIntConstant(m, "version", version); return m; } #else -PyMODINIT_FUNC -initmpatch(void) +PyMODINIT_FUNC initmpatch(void) { PyObject *m; m = Py_InitModule3("mpatch", methods, mpatch_doc); - mpatch_Error = PyErr_NewException("mercurial.cext.mpatch.mpatchError", - NULL, NULL); + mpatch_Error = + PyErr_NewException("mercurial.cext.mpatch.mpatchError", NULL, NULL); PyModule_AddIntConstant(m, "version", version); } #endif diff --git a/contrib/clang-format-blacklist b/contrib/clang-format-blacklist --- a/contrib/clang-format-blacklist +++ b/contrib/clang-format-blacklist @@ -2,7 +2,6 @@ # Do not add new files here! mercurial/cext/dirs.c mercurial/cext/manifest.c -mercurial/cext/mpatch.c mercurial/cext/osutil.c mercurial/cext/revlog.c # Vendored code that we should never format: 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
D2182: base85: allow clang-format oversight
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdf49652fafa1: base85: allow clang-format oversight (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2182?vs=5749=5753 REVISION DETAIL https://phab.mercurial-scm.org/D2182 AFFECTED FILES contrib/clang-format-blacklist mercurial/cext/base85.c CHANGE DETAILS diff --git a/mercurial/cext/base85.c b/mercurial/cext/base85.c --- a/mercurial/cext/base85.c +++ b/mercurial/cext/base85.c @@ -14,8 +14,9 @@ #include "util.h" -static const char b85chars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"; +static const char b85chars[] = +"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" +"abcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"; static char b85dec[256]; static void b85prep(void) @@ -105,25 +106,25 @@ c = b85dec[(int)*text++] - 1; if (c < 0) return PyErr_Format( - PyExc_ValueError, - "bad base85 character at position %d", - (int)i); + PyExc_ValueError, + "bad base85 character at position %d", + (int)i); acc = acc * 85 + c; } if (i++ < len) { c = b85dec[(int)*text++] - 1; if (c < 0) return PyErr_Format( - PyExc_ValueError, - "bad base85 character at position %d", - (int)i); + PyExc_ValueError, + "bad base85 character at position %d", + (int)i); /* overflow detection: 0x == "|NsC0", * "|NsC" == 0x03030303 */ if (acc > 0x03030303 || (acc *= 85) > 0x - c) return PyErr_Format( - PyExc_ValueError, - "bad base85 sequence at position %d", - (int)i); + PyExc_ValueError, + "bad base85 sequence at position %d", + (int)i); acc += c; } @@ -145,23 +146,19 @@ static char base85_doc[] = "Base85 Data Encoding"; static PyMethodDef methods[] = { - {"b85encode", b85encode, METH_VARARGS, -"Encode text in base85.\n\n" -"If the second parameter is true, pad the result to a multiple of " -"five characters.\n"}, - {"b85decode", b85decode, METH_VARARGS, "Decode base85 text.\n"}, - {NULL, NULL} +{"b85encode", b85encode, METH_VARARGS, + "Encode text in base85.\n\n" + "If the second parameter is true, pad the result to a multiple of " + "five characters.\n"}, +{"b85decode", b85decode, METH_VARARGS, "Decode base85 text.\n"}, +{NULL, NULL}, }; static const int version = 1; #ifdef IS_PY3K static struct PyModuleDef base85_module = { - PyModuleDef_HEAD_INIT, - "base85", - base85_doc, - -1, - methods +PyModuleDef_HEAD_INIT, "base85", base85_doc, -1, methods, }; PyMODINIT_FUNC PyInit_base85(void) diff --git a/contrib/clang-format-blacklist b/contrib/clang-format-blacklist --- a/contrib/clang-format-blacklist +++ b/contrib/clang-format-blacklist @@ -1,6 +1,5 @@ # Files that just need to be migrated to the formatter. # Do not add new files here! -mercurial/cext/base85.c mercurial/cext/dirs.c mercurial/cext/manifest.c mercurial/cext/mpatch.c 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
D2181: charencode: allow clang-format oversight
This revision was automatically updated to reflect the committed changes. Closed by commit rHGad352f84b782: charencode: allow clang-format oversight (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2181?vs=5748=5752 REVISION DETAIL https://phab.mercurial-scm.org/D2181 AFFECTED FILES contrib/clang-format-blacklist mercurial/cext/charencode.c CHANGE DETAILS diff --git a/mercurial/cext/charencode.c b/mercurial/cext/charencode.c --- a/mercurial/cext/charencode.c +++ b/mercurial/cext/charencode.c @@ -151,9 +151,8 @@ Py_RETURN_TRUE; } -static inline PyObject *_asciitransform(PyObject *str_obj, - const char table[128], - PyObject *fallback_fn) +static inline PyObject * +_asciitransform(PyObject *str_obj, const char table[128], PyObject *fallback_fn) { char *str, *newstr; Py_ssize_t i, len; @@ -173,12 +172,12 @@ char c = str[i]; if (c & 0x80) { if (fallback_fn != NULL) { - ret = PyObject_CallFunctionObjArgs(fallback_fn, - str_obj, NULL); + ret = PyObject_CallFunctionObjArgs( + fallback_fn, str_obj, NULL); } else { PyObject *err = PyUnicodeDecodeError_Create( - "ascii", str, len, i, (i + 1), - "unexpected code byte"); + "ascii", str, len, i, (i + 1), + "unexpected code byte"); PyErr_SetObject(PyExc_UnicodeDecodeError, err); Py_XDECREF(err); } @@ -220,10 +219,9 @@ Py_ssize_t pos = 0; const char *table; - if (!PyArg_ParseTuple(args, "O!O!O!:make_file_foldmap", - _Type, , - _Type, _obj, - _Type, _fallback)) + if (!PyArg_ParseTuple(args, "O!O!O!:make_file_foldmap", _Type, + , _Type, _obj, _Type, + _fallback)) goto quit; spec = (int)PyInt_AS_LONG(spec_obj); @@ -251,19 +249,19 @@ while (PyDict_Next(dmap, , , )) { if (!dirstate_tuple_check(v)) { PyErr_SetString(PyExc_TypeError, - "expected a dirstate tuple"); + "expected a dirstate tuple"); goto quit; } tuple = (dirstateTupleObject *)v; if (tuple->state != 'r') { PyObject *normed; if (table != NULL) { normed = _asciitransform(k, table, - normcase_fallback); +normcase_fallback); } else { normed = PyObject_CallFunctionObjArgs( - normcase_fallback, k, NULL); + normcase_fallback, k, NULL); } if (normed == NULL) @@ -292,13 +290,13 @@ char c = buf[i]; if (c & 0x80) { PyErr_SetString(PyExc_ValueError, - "cannot process non-ascii str"); + "cannot process non-ascii str"); return -1; } esclen += jsonparanoidlentable[(unsigned char)c]; if (esclen < 0) { PyErr_SetString(PyExc_MemoryError, - "overflow in jsonescapelen"); + "overflow in jsonescapelen"); return -1; } } @@ -308,7 +306,7 @@ esclen += jsonlentable[(unsigned char)c]; if (esclen < 0) { PyErr_SetString(PyExc_MemoryError, - "overflow in jsonescapelen"); + "overflow in jsonescapelen"); return -1; } } @@ -336,17 +334,17 @@ case '\\': return '\\'; } - return '\0'; /* should not happen */ + return '\0'; /* should not happen */ } /* convert 'origbuf' to JSON-escaped form 'escbuf'; 'origbuf'
D2275: formatting: enforce system headers before local headers
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd97db568f7e7: formatting: enforce system headers before local headers (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2275?vs=5747=5751 REVISION DETAIL https://phab.mercurial-scm.org/D2275 AFFECTED FILES .clang-format CHANGE DETAILS diff --git a/.clang-format b/.clang-format --- a/.clang-format +++ b/.clang-format @@ -6,3 +6,8 @@ IndentCaseLabels: false AllowShortBlocksOnASingleLine: false AllowShortFunctionsOnASingleLine: false +IncludeCategories: + - Regex: '^<' +Priority:1 + - Regex: '^"' +Priority:2 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
D1808: debugcommands: print out the editor that was searched for (post shlexsplit)
krbullock added a comment. @durin42 Go for it REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1808 To: spectral, #hg-reviewers, krbullock Cc: durin42, krbullock, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1919: phabricator: specify API tokens per host, rather than per repo
quark added a comment. In https://phab.mercurial-scm.org/D1919#37546, @durin42 wrote: > Sorry, this slipped through the cracks. If we think we want to start reading .arcconfig, should we just go straight to that and discard our own auth config area, and incur a BC only once? One good thing about hgrc is, editing hgrc is human-friendly. I think editing `.arcrc` is not. If we decided to use `.arcrc`, that means there needs to be some program that edits it. It could be `arc`, but that's not friendly for people who don't want PHP. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1919 To: tom.prince, #hg-reviewers, durin42 Cc: quark, indygreg, durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2182: base85: allow clang-format oversight
durin42 updated this revision to Diff 5749. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2182?vs=5492=5749 REVISION DETAIL https://phab.mercurial-scm.org/D2182 AFFECTED FILES contrib/clang-format-blacklist mercurial/cext/base85.c CHANGE DETAILS diff --git a/mercurial/cext/base85.c b/mercurial/cext/base85.c --- a/mercurial/cext/base85.c +++ b/mercurial/cext/base85.c @@ -14,8 +14,9 @@ #include "util.h" -static const char b85chars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"; +static const char b85chars[] = +"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" +"abcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"; static char b85dec[256]; static void b85prep(void) @@ -105,25 +106,25 @@ c = b85dec[(int)*text++] - 1; if (c < 0) return PyErr_Format( - PyExc_ValueError, - "bad base85 character at position %d", - (int)i); + PyExc_ValueError, + "bad base85 character at position %d", + (int)i); acc = acc * 85 + c; } if (i++ < len) { c = b85dec[(int)*text++] - 1; if (c < 0) return PyErr_Format( - PyExc_ValueError, - "bad base85 character at position %d", - (int)i); + PyExc_ValueError, + "bad base85 character at position %d", + (int)i); /* overflow detection: 0x == "|NsC0", * "|NsC" == 0x03030303 */ if (acc > 0x03030303 || (acc *= 85) > 0x - c) return PyErr_Format( - PyExc_ValueError, - "bad base85 sequence at position %d", - (int)i); + PyExc_ValueError, + "bad base85 sequence at position %d", + (int)i); acc += c; } @@ -145,23 +146,19 @@ static char base85_doc[] = "Base85 Data Encoding"; static PyMethodDef methods[] = { - {"b85encode", b85encode, METH_VARARGS, -"Encode text in base85.\n\n" -"If the second parameter is true, pad the result to a multiple of " -"five characters.\n"}, - {"b85decode", b85decode, METH_VARARGS, "Decode base85 text.\n"}, - {NULL, NULL} +{"b85encode", b85encode, METH_VARARGS, + "Encode text in base85.\n\n" + "If the second parameter is true, pad the result to a multiple of " + "five characters.\n"}, +{"b85decode", b85decode, METH_VARARGS, "Decode base85 text.\n"}, +{NULL, NULL}, }; static const int version = 1; #ifdef IS_PY3K static struct PyModuleDef base85_module = { - PyModuleDef_HEAD_INIT, - "base85", - base85_doc, - -1, - methods +PyModuleDef_HEAD_INIT, "base85", base85_doc, -1, methods, }; PyMODINIT_FUNC PyInit_base85(void) diff --git a/contrib/clang-format-blacklist b/contrib/clang-format-blacklist --- a/contrib/clang-format-blacklist +++ b/contrib/clang-format-blacklist @@ -1,6 +1,5 @@ # Files that just need to be migrated to the formatter. # Do not add new files here! -mercurial/cext/base85.c mercurial/cext/dirs.c mercurial/cext/manifest.c mercurial/cext/mpatch.c 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
D2183: mpatch: allow clang-format oversight
durin42 updated this revision to Diff 5750. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2183?vs=5493=5750 REVISION DETAIL https://phab.mercurial-scm.org/D2183 AFFECTED FILES contrib/clang-format-blacklist mercurial/cext/mpatch.c CHANGE DETAILS diff --git a/mercurial/cext/mpatch.c b/mercurial/cext/mpatch.c --- a/mercurial/cext/mpatch.c +++ b/mercurial/cext/mpatch.c @@ -55,10 +55,10 @@ ssize_t blen; int r; - PyObject *tmp = PyList_GetItem((PyObject*)bins, pos); + PyObject *tmp = PyList_GetItem((PyObject *)bins, pos); if (!tmp) return NULL; - if (PyObject_AsCharBuffer(tmp, , (Py_ssize_t*))) + if (PyObject_AsCharBuffer(tmp, , (Py_ssize_t *))) return NULL; if ((r = mpatch_decode(buffer, blen, )) < 0) { if (!PyErr_Occurred()) @@ -68,8 +68,7 @@ return res; } -static PyObject * -patches(PyObject *self, PyObject *args) +static PyObject *patches(PyObject *self, PyObject *args) { PyObject *text, *bins, *result; struct mpatch_flist *patch; @@ -123,8 +122,7 @@ } /* calculate size of a patched file directly */ -static PyObject * -patchedsize(PyObject *self, PyObject *args) +static PyObject *patchedsize(PyObject *self, PyObject *args) { long orig, start, end, len, outlen = 0, last = 0, pos = 0; Py_ssize_t patchlen; @@ -147,29 +145,26 @@ if (pos != patchlen) { if (!PyErr_Occurred()) - PyErr_SetString(mpatch_Error, "patch cannot be decoded"); + PyErr_SetString(mpatch_Error, + "patch cannot be decoded"); return NULL; } outlen += orig - last; return Py_BuildValue("l", outlen); } static PyMethodDef methods[] = { - {"patches", patches, METH_VARARGS, "apply a series of patches\n"}, - {"patchedsize", patchedsize, METH_VARARGS, "calculed patched size\n"}, - {NULL, NULL} +{"patches", patches, METH_VARARGS, "apply a series of patches\n"}, +{"patchedsize", patchedsize, METH_VARARGS, "calculed patched size\n"}, +{NULL, NULL}, }; static const int version = 1; #ifdef IS_PY3K static struct PyModuleDef mpatch_module = { - PyModuleDef_HEAD_INIT, - "mpatch", - mpatch_doc, - -1, - methods +PyModuleDef_HEAD_INIT, "mpatch", mpatch_doc, -1, methods, }; PyMODINIT_FUNC PyInit_mpatch(void) @@ -180,22 +175,21 @@ if (m == NULL) return NULL; - mpatch_Error = PyErr_NewException("mercurial.cext.mpatch.mpatchError", - NULL, NULL); + mpatch_Error = + PyErr_NewException("mercurial.cext.mpatch.mpatchError", NULL, NULL); Py_INCREF(mpatch_Error); PyModule_AddObject(m, "mpatchError", mpatch_Error); PyModule_AddIntConstant(m, "version", version); return m; } #else -PyMODINIT_FUNC -initmpatch(void) +PyMODINIT_FUNC initmpatch(void) { PyObject *m; m = Py_InitModule3("mpatch", methods, mpatch_doc); - mpatch_Error = PyErr_NewException("mercurial.cext.mpatch.mpatchError", - NULL, NULL); + mpatch_Error = + PyErr_NewException("mercurial.cext.mpatch.mpatchError", NULL, NULL); PyModule_AddIntConstant(m, "version", version); } #endif diff --git a/contrib/clang-format-blacklist b/contrib/clang-format-blacklist --- a/contrib/clang-format-blacklist +++ b/contrib/clang-format-blacklist @@ -2,7 +2,6 @@ # Do not add new files here! mercurial/cext/dirs.c mercurial/cext/manifest.c -mercurial/cext/mpatch.c mercurial/cext/osutil.c mercurial/cext/revlog.c # Vendored code that we should never format: 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
D2181: charencode: allow clang-format oversight
durin42 updated this revision to Diff 5748. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2181?vs=5491=5748 REVISION DETAIL https://phab.mercurial-scm.org/D2181 AFFECTED FILES contrib/clang-format-blacklist mercurial/cext/charencode.c CHANGE DETAILS diff --git a/mercurial/cext/charencode.c b/mercurial/cext/charencode.c --- a/mercurial/cext/charencode.c +++ b/mercurial/cext/charencode.c @@ -151,9 +151,8 @@ Py_RETURN_TRUE; } -static inline PyObject *_asciitransform(PyObject *str_obj, - const char table[128], - PyObject *fallback_fn) +static inline PyObject * +_asciitransform(PyObject *str_obj, const char table[128], PyObject *fallback_fn) { char *str, *newstr; Py_ssize_t i, len; @@ -173,12 +172,12 @@ char c = str[i]; if (c & 0x80) { if (fallback_fn != NULL) { - ret = PyObject_CallFunctionObjArgs(fallback_fn, - str_obj, NULL); + ret = PyObject_CallFunctionObjArgs( + fallback_fn, str_obj, NULL); } else { PyObject *err = PyUnicodeDecodeError_Create( - "ascii", str, len, i, (i + 1), - "unexpected code byte"); + "ascii", str, len, i, (i + 1), + "unexpected code byte"); PyErr_SetObject(PyExc_UnicodeDecodeError, err); Py_XDECREF(err); } @@ -220,10 +219,9 @@ Py_ssize_t pos = 0; const char *table; - if (!PyArg_ParseTuple(args, "O!O!O!:make_file_foldmap", - _Type, , - _Type, _obj, - _Type, _fallback)) + if (!PyArg_ParseTuple(args, "O!O!O!:make_file_foldmap", _Type, + , _Type, _obj, _Type, + _fallback)) goto quit; spec = (int)PyInt_AS_LONG(spec_obj); @@ -251,19 +249,19 @@ while (PyDict_Next(dmap, , , )) { if (!dirstate_tuple_check(v)) { PyErr_SetString(PyExc_TypeError, - "expected a dirstate tuple"); + "expected a dirstate tuple"); goto quit; } tuple = (dirstateTupleObject *)v; if (tuple->state != 'r') { PyObject *normed; if (table != NULL) { normed = _asciitransform(k, table, - normcase_fallback); +normcase_fallback); } else { normed = PyObject_CallFunctionObjArgs( - normcase_fallback, k, NULL); + normcase_fallback, k, NULL); } if (normed == NULL) @@ -292,13 +290,13 @@ char c = buf[i]; if (c & 0x80) { PyErr_SetString(PyExc_ValueError, - "cannot process non-ascii str"); + "cannot process non-ascii str"); return -1; } esclen += jsonparanoidlentable[(unsigned char)c]; if (esclen < 0) { PyErr_SetString(PyExc_MemoryError, - "overflow in jsonescapelen"); + "overflow in jsonescapelen"); return -1; } } @@ -308,7 +306,7 @@ esclen += jsonlentable[(unsigned char)c]; if (esclen < 0) { PyErr_SetString(PyExc_MemoryError, - "overflow in jsonescapelen"); + "overflow in jsonescapelen"); return -1; } } @@ -336,17 +334,17 @@ case '\\': return '\\'; } - return '\0'; /* should not happen */ + return '\0'; /* should not happen */ } /* convert 'origbuf' to JSON-escaped form 'escbuf'; 'origbuf' should only include characters mappable by json(paranoid)lentable */ static void encodejsonescape(char *escbuf, Py_ssize_t esclen, -
D2275: formatting: enforce system headers before local headers
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/D2275 AFFECTED FILES .clang-format CHANGE DETAILS diff --git a/.clang-format b/.clang-format --- a/.clang-format +++ b/.clang-format @@ -6,3 +6,8 @@ IndentCaseLabels: false AllowShortBlocksOnASingleLine: false AllowShortFunctionsOnASingleLine: false +IncludeCategories: + - Regex: '^<' +Priority:1 + - Regex: '^"' +Priority:2 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
D2218: wireprotoserver: rename webproto to httpv1protocolhandler
This revision was automatically updated to reflect the committed changes. Closed by commit rHG42bf7b6de53c: wireprotoserver: rename webproto to httpv1protocolhandler (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2218?vs=5617=5744 REVISION DETAIL https://phab.mercurial-scm.org/D2218 AFFECTED FILES mercurial/wireprotoserver.py CHANGE DETAILS diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -105,7 +105,7 @@ return ''.join(chunks) -class webproto(baseprotocolhandler): +class httpv1protocolhandler(baseprotocolhandler): def __init__(self, req, ui): self._req = req self._ui = ui @@ -201,7 +201,7 @@ if cmd not in wireproto.commands: return None -proto = webproto(req, repo.ui) +proto = httpv1protocolhandler(req, repo.ui) return { 'cmd': cmd, To: indygreg, #hg-reviewers, lothiraldan Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2204: wireprotoserver: handle SSH protocol version 2 upgrade requests
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2c11f8d5554b: wireprotoserver: handle SSH protocol version 2 upgrade requests (authored by indygreg, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D2204?vs=5573=5738#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2204?vs=5573=5738 REVISION DETAIL https://phab.mercurial-scm.org/D2204 AFFECTED FILES mercurial/configitems.py mercurial/wireprotoserver.py tests/sshprotoext.py tests/test-ssh-proto.t CHANGE DETAILS diff --git a/tests/test-ssh-proto.t b/tests/test-ssh-proto.t --- a/tests/test-ssh-proto.t +++ b/tests/test-ssh-proto.t @@ -453,9 +453,17 @@ local: no pushable: yes +Enable version 2 support on server. We need to do this in hgrc because we can't +use --config with `hg serve --stdio`. + + $ cat >> server/.hg/hgrc << EOF + > [experimental] + > sshserver.support-v2 = true + > EOF + Send an upgrade request to a server that supports upgrade - $ SSHSERVERMODE=upgradev2 hg -R server serve --stdio << EOF + $ hg -R server serve --stdio << EOF > upgrade this-is-some-token proto=exp-ssh-v2-0001 > hello > between @@ -466,7 +474,7 @@ 383 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN - $ SSHSERVERMODE=upgradev2 hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server + $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) sending upgrade request: * proto=exp-ssh-v2-0001 (glob) @@ -482,7 +490,7 @@ Verify the peer has capabilities - $ SSHSERVERMODE=upgradev2 hg --config experimental.sshpeer.advertise-v2=true --debug debugcapabilities ssh://user@dummy/server + $ hg --config experimental.sshpeer.advertise-v2=true --debug debugcapabilities ssh://user@dummy/server running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) sending upgrade request: * proto=exp-ssh-v2-0001 (glob) @@ -527,3 +535,96 @@ remote-changegroup http https + +Command after upgrade to version 2 is processed + + $ hg -R server serve --stdio << EOF + > upgrade this-is-some-token proto=exp-ssh-v2-0001 + > hello + > between + > pairs 81 + > -hello + > EOF + upgraded this-is-some-token exp-ssh-v2-0001 + 383 + capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + 384 + capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + +Multiple upgrades is not allowed + + $ hg -R server serve --stdio << EOF + > upgrade this-is-some-token proto=exp-ssh-v2-0001 + > hello + > between + > pairs 81 + > -upgrade another-token proto=irrelevant + > hello + > EOF + upgraded this-is-some-token exp-ssh-v2-0001 + 383 + capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + cannot upgrade protocols multiple times + - + + +Malformed upgrade request line (not exactly 3 space delimited tokens) + + $ hg -R server serve --stdio << EOF + > upgrade + > EOF + 0 + + $ hg -R server serve --stdio << EOF + > upgrade token + > EOF + 0 + + $ hg -R server serve --stdio << EOF + > upgrade token foo=bar extra-token + > EOF + 0 + +Upgrade request to unsupported protocol is ignored + + $ hg -R server serve --stdio << EOF + > upgrade this-is-some-token proto=unknown1,unknown2 + > hello + > between + > pairs 81 + > - + > EOF + 0 + 384 + capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + 1 + + +Upgrade request must be followed by hello + between + + $ hg -R server serve --stdio << EOF + > upgrade token proto=exp-ssh-v2-0001 + > invalid + > EOF + malformed handshake protocol: missing hello + - + + + $ hg -R server serve --stdio << EOF + > upgrade token proto=exp-ssh-v2-0001 + > hello + > invalid + >
D2206: tests: test using both versions of SSH protocol
This revision was automatically updated to reflect the committed changes. Closed by commit rHG32ffa12b5c66: tests: test using both versions of SSH protocol (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2206?vs=5575=5740 REVISION DETAIL https://phab.mercurial-scm.org/D2206 AFFECTED FILES tests/test-bundle2-exchange.t tests/test-bundle2-pushback.t tests/test-bundle2-remote-changegroup.t tests/test-clone.t tests/test-largefiles-wireproto.t tests/test-pull.t tests/test-ssh-bundle1.t tests/test-ssh-clone-r.t tests/test-ssh.t CHANGE DETAILS diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -1,3 +1,12 @@ +#testcases sshv1 sshv2 + +#if sshv2 + $ cat >> $HGRCPATH << EOF + > [experimental] + > sshpeer.advertise-v2 = true + > sshserver.support-v2 = true + > EOF +#endif This test tries to exercise the ssh functionality with a dummy script @@ -481,14 +490,16 @@ $ hg pull --debug ssh://user@dummy/remote --config devel.debug.peer-request=yes pulling from ssh://user@dummy/remote running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re) + sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !) devel-peer-request: hello sending hello command devel-peer-request: between devel-peer-request: pairs: 81 bytes sending between command - remote: 384 + remote: 384 (sshv1 !) + protocol upgraded to exp-ssh-v2-0001 (sshv2 !) remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN - remote: 1 + remote: 1 (sshv1 !) query 1; heads devel-peer-request: batch devel-peer-request: cmds: 141 bytes diff --git a/tests/test-ssh-clone-r.t b/tests/test-ssh-clone-r.t --- a/tests/test-ssh-clone-r.t +++ b/tests/test-ssh-clone-r.t @@ -1,5 +1,15 @@ This test tries to exercise the ssh functionality with a dummy script +#testcases sshv1 sshv2 + +#if sshv2 + $ cat >> $HGRCPATH << EOF + > [experimental] + > sshpeer.advertise-v2 = true + > sshserver.support-v2 = true + > EOF +#endif + creating 'remote' repo $ hg init remote diff --git a/tests/test-ssh-bundle1.t b/tests/test-ssh-bundle1.t --- a/tests/test-ssh-bundle1.t +++ b/tests/test-ssh-bundle1.t @@ -1,6 +1,16 @@ This test is a duplicate of 'test-http.t' feel free to factor out parts that are not bundle1/bundle2 specific. +#testcases sshv1 sshv2 + +#if sshv2 + $ cat >> $HGRCPATH << EOF + > [experimental] + > sshpeer.advertise-v2 = true + > sshserver.support-v2 = true + > EOF +#endif + $ cat << EOF >> $HGRCPATH > [devel] > # This test is dedicated to interaction through old bundle @@ -465,11 +475,13 @@ $ hg pull --debug ssh://user@dummy/remote pulling from ssh://user@dummy/remote running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re) + sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !) sending hello command sending between command - remote: 384 + protocol upgraded to exp-ssh-v2-0001 (sshv2 !) + remote: 384 (sshv1 !) remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN - remote: 1 + remote: 1 (sshv1 !) preparing listkeys for "bookmarks" sending listkeys command received listkey for "bookmarks": 45 bytes diff --git a/tests/test-pull.t b/tests/test-pull.t --- a/tests/test-pull.t +++ b/tests/test-pull.t @@ -1,5 +1,15 @@ #require serve +#testcases sshv1 sshv2 + +#if sshv2 + $ cat >> $HGRCPATH << EOF + > [experimental] + > sshpeer.advertise-v2 = true + > sshserver.support-v2 = true + > EOF +#endif + $ hg init test $ cd test diff --git a/tests/test-largefiles-wireproto.t b/tests/test-largefiles-wireproto.t --- a/tests/test-largefiles-wireproto.t +++ b/tests/test-largefiles-wireproto.t @@ -1,3 +1,13 @@ +#testcases sshv1 sshv2 + +#if sshv2 + $ cat >> $HGRCPATH << EOF + > [experimental] + > sshpeer.advertise-v2 = true + > sshserver.support-v2 = true + > EOF +#endif + This file contains testcases that tend to be related to the wire protocol part of largefiles. diff --git a/tests/test-clone.t b/tests/test-clone.t --- a/tests/test-clone.t +++ b/tests/test-clone.t @@ -1,3 +1,13 @@ +#testcases sshv1 sshv2 + +#if sshv2 + $ cat >> $HGRCPATH << EOF + > [experimental] + > sshpeer.advertise-v2 = true + > sshserver.support-v2 = true + > EOF +#endif + Prepare repo a: $ hg init a @@ -1142,33 +1152,38 @@ #if windows $ hg clone "ssh://%26touch%20owned%20/" --debug running sh -c "read l; read l; read l" " owned " "hg -R . serve --stdio" + sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !) sending hello command sending between command
D2217: wireproto: improve docstring for "hello"
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe6692cd58ae9: wireproto: improve docstring for hello (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2217?vs=5616=5745 REVISION DETAIL https://phab.mercurial-scm.org/D2217 AFFECTED FILES mercurial/wireproto.py CHANGE DETAILS diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -901,13 +901,16 @@ @wireprotocommand('hello') def hello(repo, proto): -'''the hello command returns a set of lines describing various -interesting things about the server, in an RFC822-like format. -Currently the only one defined is "capabilities", which -consists of a line in the form: +"""Called as part of SSH handshake to obtain server info. + +Returns a list of lines describing interesting things about the +server, in an RFC822-like format. -capabilities: space separated list of tokens -''' +Currently, the only one defined is ``capabilities``, which consists of a +line of space separated tokens describing server abilities: + +capabilities: +""" caps = capabilities(repo, proto).data return bytesresponse('capabilities: %s\n' % caps) To: indygreg, #hg-reviewers, lothiraldan Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2215: httppeer: remove redundant code to fetch capabilities
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd4012729cfe0: httppeer: remove redundant code to fetch capabilities (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2215?vs=5614=5743 REVISION DETAIL https://phab.mercurial-scm.org/D2215 AFFECTED FILES mercurial/httppeer.py CHANGE DETAILS diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -221,13 +221,9 @@ # Begin of _basewirepeer interface. def capabilities(self): -if self._caps is None: -try: -self._fetchcaps() -except error.RepoError: -self._caps = set() -self.ui.debug('capabilities: %s\n' % - (' '.join(self._caps or ['none']))) +# self._fetchcaps() should have been called as part of peer +# handshake. So self._caps should always be set. +assert self._caps is not None return self._caps # End of _basewirepeer interface. To: indygreg, #hg-reviewers, lothiraldan Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2219: wireprotoserver: add version to HTTP protocol name (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHGf775c3618c43: wireprotoserver: add version to HTTP protocol name (API) (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2219?vs=5618=5746 REVISION DETAIL https://phab.mercurial-scm.org/D2219 AFFECTED FILES mercurial/wireproto.py mercurial/wireprotoserver.py CHANGE DETAILS diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -112,7 +112,7 @@ @property def name(self): -return 'http' +return 'http-v1' def getargs(self, args): knownargs = self._args() diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -778,7 +778,7 @@ caps.append('bundle2=' + urlreq.quote(capsblob)) caps.append('unbundle=%s' % ','.join(bundle2.bundlepriority)) -if proto.name == 'http': +if proto.name == 'http-v1': caps.append('httpheader=%d' % repo.ui.configint('server', 'maxhttpheaderlen')) if repo.ui.configbool('experimental', 'httppostargs'): @@ -852,7 +852,7 @@ if not bundle1allowed(repo, 'pull'): if not exchange.bundle2requested(opts.get('bundlecaps')): -if proto.name == 'http': +if proto.name == 'http-v1': return ooberror(bundle2required) raise error.Abort(bundle2requiredmain, hint=bundle2requiredhint) @@ -878,7 +878,7 @@ except error.Abort as exc: # cleanly forward Abort error to the client if not exchange.bundle2requested(opts.get('bundlecaps')): -if proto.name == 'http': +if proto.name == 'http-v1': return ooberror(str(exc) + '\n') raise # cannot do better for bundle1 + ssh # bundle2 request expect a bundle2 reply @@ -983,7 +983,7 @@ gen = exchange.readbundle(repo.ui, fp, None) if (isinstance(gen, changegroupmod.cg1unpacker) and not bundle1allowed(repo, 'push')): -if proto.name == 'http': +if proto.name == 'http-v1': # need to special case http because stderr do not get to # the http client on failed push so we need to abuse # some other error type to make sure the message get to To: indygreg, #hg-reviewers, lothiraldan Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2216: httppeer: remove httpspeer
This revision was automatically updated to reflect the committed changes. Closed by commit rHGf6c7733655fc: httppeer: remove httpspeer (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2216?vs=5615=5742 REVISION DETAIL https://phab.mercurial-scm.org/D2216 AFFECTED FILES mercurial/httppeer.py CHANGE DETAILS diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -480,22 +480,15 @@ def _abort(self, exception): raise exception -class httpspeer(httppeer): -def __init__(self, ui, path): -if not url.has_https: -raise error.Abort(_('Python support for SSL and HTTPS ' - 'is not installed')) -httppeer.__init__(self, ui, path) - def instance(ui, path, create): if create: raise error.Abort(_('cannot create new http repository')) try: -if path.startswith('https:'): -inst = httpspeer(ui, path) -else: -inst = httppeer(ui, path) +if path.startswith('https:') and not url.has_https: +raise error.Abort(_('Python support for SSL and HTTPS ' +'is not installed')) +inst = httppeer(ui, path) inst._fetchcaps() return inst To: indygreg, #hg-reviewers, lothiraldan Cc: lothiraldan, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2235: manifest: add support for including directories outside narrowspec
This revision was automatically updated to reflect the committed changes. Closed by commit rHG5c9bdfb32eac: manifest: add support for including directories outside narrowspec (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2235?vs=5657=5733 REVISION DETAIL https://phab.mercurial-scm.org/D2235 AFFECTED FILES mercurial/commands.py tests/test-narrow-commit.t CHANGE DETAILS diff --git a/tests/test-narrow-commit.t b/tests/test-narrow-commit.t --- a/tests/test-narrow-commit.t +++ b/tests/test-narrow-commit.t @@ -77,12 +77,20 @@ $ hg update -q 'desc("initial")' $ echo modified2 > inside/f1 + $ hg manifest --debug + 4d6a634d5ba06331a60c29ee0db8412490a54fcd 644 inside/f1 + 7fb3bb6356d28d4dc352c5ba52d7350a81b6bd46 644 outside/f1 (flat !) + d0f2f706468ab0e8bec7af87446835fb1b13511b 755 d outside/ (tree !) $ hg commit -m 'modify inside/f1' created new head $ hg files -r . inside/f1 outside/f1 (flat !) outside/ (tree !) + $ hg manifest --debug + 3f4197b4a11b9016e77ebc47fe566944885fd11b 644 inside/f1 + 7fb3bb6356d28d4dc352c5ba52d7350a81b6bd46 644 outside/f1 (flat !) + d0f2f706468ab0e8bec7af87446835fb1b13511b 755 d outside/ (tree !) Some filesystems (notably FAT/exFAT only store timestamps with 2 seconds of precision, so by sleeping for 3 seconds, we can ensure that the timestamps of files stored by dirstate will appear older than the diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3491,8 +3491,8 @@ if not node: node = rev -char = {'l': '@', 'x': '*', '': ''} -mode = {'l': '644', 'x': '755', '': '644'} +char = {'l': '@', 'x': '*', '': '', 't': 'd'} +mode = {'l': '644', 'x': '755', '': '644', 't': '755'} if node: repo = scmutil.unhidehashlikerevs(repo, [node], 'nowarn') ctx = scmutil.revsingle(repo, node) To: martinvonz, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2205: sshpeer: log remote capabilities after protocol upgrade
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb06bba6d821d: sshpeer: log remote capabilities after protocol upgrade (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2205?vs=5574=5739 REVISION DETAIL https://phab.mercurial-scm.org/D2205 AFFECTED FILES mercurial/sshpeer.py tests/test-ssh-proto.t CHANGE DETAILS diff --git a/tests/test-ssh-proto.t b/tests/test-ssh-proto.t --- a/tests/test-ssh-proto.t +++ b/tests/test-ssh-proto.t @@ -484,6 +484,7 @@ devel-peer-request: pairs: 81 bytes sending between command protocol upgraded to exp-ssh-v2-0001 + remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN url: ssh://user@dummy/server local: no pushable: yes @@ -500,6 +501,7 @@ devel-peer-request: pairs: 81 bytes sending between command protocol upgraded to exp-ssh-v2-0001 + remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN Main capabilities: batch branchmap diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py --- a/mercurial/sshpeer.py +++ b/mercurial/sshpeer.py @@ -313,6 +313,8 @@ if not capsline.startswith('capabilities: '): badresponse() +ui.debug('remote: %s\n' % capsline) + caps.update(capsline.split(':')[1].split()) # Trailing newline. stdout.read(1) To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2274: py3: stringify integer with %d instead of bytes()
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb67d4b7e8235: py3: stringify integer with %d instead of bytes() (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2274?vs=5729=5736 REVISION DETAIL https://phab.mercurial-scm.org/D2274 AFFECTED FILES mercurial/wireprotoserver.py CHANGE DETAILS diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -445,7 +445,7 @@ _sshv1respondstream(self._fout, rsp) elif isinstance(rsp, wireprototypes.pushres): _sshv1respondbytes(self._fout, b'') -_sshv1respondbytes(self._fout, bytes(rsp.res)) +_sshv1respondbytes(self._fout, b'%d' % rsp.res) elif isinstance(rsp, wireprototypes.pusherr): _sshv1respondbytes(self._fout, rsp.res) elif isinstance(rsp, wireprototypes.ooberror): To: indygreg, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2203: wireprotoserver: move SSH server operation to a standalone function
This revision was automatically updated to reflect the committed changes. Closed by commit rHGabd6a0e32e22: wireprotoserver: move SSH server operation to a standalone function (authored by indygreg, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D2203?vs=5572=5737#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2203?vs=5572=5737 REVISION DETAIL https://phab.mercurial-scm.org/D2203 AFFECTED FILES mercurial/wireprotoserver.py tests/sshprotoext.py tests/test-sshserver.py CHANGE DETAILS diff --git a/tests/test-sshserver.py b/tests/test-sshserver.py --- a/tests/test-sshserver.py +++ b/tests/test-sshserver.py @@ -23,8 +23,11 @@ def assertparse(self, cmd, input, expected): server = mockserver(input) +proto = wireprotoserver.sshv1protocolhandler(server._ui, + server._fin, + server._fout) _func, spec = wireproto.commands[cmd] -self.assertEqual(server._proto.getargs(spec), expected) +self.assertEqual(proto.getargs(spec), expected) def mockserver(inbytes): ui = mockui(inbytes) diff --git a/tests/sshprotoext.py b/tests/sshprotoext.py --- a/tests/sshprotoext.py +++ b/tests/sshprotoext.py @@ -48,7 +48,9 @@ wireprotoserver._sshv1respondbytes(self._fout, b'') l = self._fin.readline() assert l == b'between\n' -rsp = wireproto.dispatch(self._repo, self._proto, b'between') +proto = wireprotoserver.sshv1protocolhandler(self._ui, self._fin, + self._fout) +rsp = wireproto.dispatch(self._repo, proto, b'between') wireprotoserver._sshv1respondbytes(self._fout, rsp.data) super(prehelloserver, self).serve_forever() @@ -72,8 +74,10 @@ self._fin.read(81) # Send the upgrade response. +proto = wireprotoserver.sshv1protocolhandler(self._ui, self._fin, + self._fout) self._fout.write(b'upgraded %s %s\n' % (token, name)) -servercaps = wireproto.capabilities(self._repo, self._proto) +servercaps = wireproto.capabilities(self._repo, proto) rsp = b'capabilities: %s' % servercaps.data self._fout.write(b'%d\n' % len(rsp)) self._fout.write(rsp) diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -409,6 +409,56 @@ client = encoding.environ.get('SSH_CLIENT', '').split(' ', 1)[0] return 'remote:ssh:' + client +def _runsshserver(ui, repo, fin, fout): +state = 'protov1-serving' +proto = sshv1protocolhandler(ui, fin, fout) + +while True: +if state == 'protov1-serving': +# Commands are issued on new lines. +request = fin.readline()[:-1] + +# Empty lines signal to terminate the connection. +if not request: +state = 'shutdown' +continue + +available = wireproto.commands.commandavailable(request, proto) + +# This command isn't available. Send an empty response and go +# back to waiting for a new command. +if not available: +_sshv1respondbytes(fout, b'') +continue + +rsp = wireproto.dispatch(repo, proto, request) + +if isinstance(rsp, bytes): +_sshv1respondbytes(fout, rsp) +elif isinstance(rsp, wireprototypes.bytesresponse): +_sshv1respondbytes(fout, rsp.data) +elif isinstance(rsp, wireprototypes.streamres): +_sshv1respondstream(fout, rsp) +elif isinstance(rsp, wireprototypes.streamreslegacy): +_sshv1respondstream(fout, rsp) +elif isinstance(rsp, wireprototypes.pushres): +_sshv1respondbytes(fout, b'') +_sshv1respondbytes(fout, b'%d' % rsp.res) +elif isinstance(rsp, wireprototypes.pusherr): +_sshv1respondbytes(fout, rsp.res) +elif isinstance(rsp, wireprototypes.ooberror): +_sshv1respondooberror(fout, ui.ferr, rsp.message) +else: +raise error.ProgrammingError('unhandled response type from ' + 'wire protocol command: %s' % rsp) + +elif state == 'shutdown': +break + +else: +raise error.ProgrammingError('unhandled ssh server state: %s' % + state) + class sshserver(object): def __init__(self, ui, repo): self._ui = ui @@ -423,36 +473,8 @@ util.setbinary(self._fin) util.setbinary(self._fout) -self._proto = sshv1protocolhandler(self._ui, self._fin, self._fout) - def
D2214: httppeer: change logic around argument handling
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb4b910c5c0d4: httppeer: change logic around argument handling (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2214?vs=5613=5741 REVISION DETAIL https://phab.mercurial-scm.org/D2214 AFFECTED FILES mercurial/httppeer.py CHANGE DETAILS diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -252,6 +252,8 @@ # with infinite recursion when trying to look up capabilities # for the first time. postargsok = self._caps is not None and 'httppostargs' in self._caps + +# Send arguments via POST. if postargsok and args: strargs = urlreq.urlencode(sorted(args.items())) if not data: @@ -265,20 +267,27 @@ argsio.length = len(strargs) data = _multifile(argsio, data) headers[r'X-HgArgs-Post'] = len(strargs) -else: -if len(args) > 0: -httpheader = self.capable('httpheader') -if httpheader: -headersize = int(httpheader.split(',', 1)[0]) +elif args: +# Calling self.capable() can infinite loop if we are calling +# "capabilities". But that command should never accept wire +# protocol arguments. So this should never happen. +assert cmd != 'capabilities' +httpheader = self.capable('httpheader') +if httpheader: +headersize = int(httpheader.split(',', 1)[0]) + +# Send arguments via HTTP headers. if headersize > 0: # The headers can typically carry more data than the URL. encargs = urlreq.urlencode(sorted(args.items())) for header, value in encodevalueinheaders(encargs, 'X-HgArg', headersize): headers[header] = value varyheaders.append(header) +# Send arguments via query string (Mercurial <1.9). else: q += sorted(args.items()) + qs = '?%s' % urlreq.urlencode(q) cu = "%s%s" % (self._url, qs) size = 0 To: indygreg, #hg-reviewers, lothiraldan Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2234: narrow: restrict manifest iteration by using manifest.walk(matcher)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2ad527f7d27a: narrow: restrict manifest iteration by using manifest.walk(matcher) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2234?vs=5656=5732 REVISION DETAIL https://phab.mercurial-scm.org/D2234 AFFECTED FILES hgext/narrow/narrowbundle2.py CHANGE DETAILS diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -152,7 +152,7 @@ else: # For a root node, we need to include the node if any # files in the node match the narrowspec. -needed = any(match(f) for f in curmf) +needed = any(curmf.walk(match)) if needed: for head in ellipsisheads[rev]: To: martinvonz, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2272: py3: add b'' to config options in test extension
This revision was automatically updated to reflect the committed changes. Closed by commit rHG30cc9f9780df: py3: add b to config options in test extension (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2272?vs=5727=5734 REVISION DETAIL https://phab.mercurial-scm.org/D2272 AFFECTED FILES tests/sshprotoext.py CHANGE DETAILS diff --git a/tests/sshprotoext.py b/tests/sshprotoext.py --- a/tests/sshprotoext.py +++ b/tests/sshprotoext.py @@ -22,8 +22,8 @@ configtable = {} configitem = registrar.configitem(configtable) -configitem('sshpeer', 'mode', default=None) -configitem('sshpeer', 'handshake-mode', default=None) +configitem(b'sshpeer', b'mode', default=None) +configitem(b'sshpeer', b'handshake-mode', default=None) class bannerserver(wireprotoserver.sshserver): """Server that sends a banner to stdout.""" To: indygreg, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2233: narrow: only diff manifest part within narrowspec when generating changegroup
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc407ccd06abd: narrow: only diff manifest part within narrowspec when generating changegroup (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2233?vs=5655=5731 REVISION DETAIL https://phab.mercurial-scm.org/D2233 AFFECTED FILES hgext/narrow/narrowbundle2.py CHANGE DETAILS diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -141,14 +141,14 @@ # changesets because it's not always correct. TODO: could # we trust it for the non-merge case? p1mf = mfl[cl.changelogrevision(ps[0]).manifest].read() -needed = any(match(f) for f in curmf.diff(p1mf).iterkeys()) +needed = bool(curmf.diff(p1mf, match)) if not needed and len(ps) > 1: # For merge changes, the list of changed files is not # helpful, since we need to emit the merge if a file # in the narrow spec has changed on either side of the # merge. As a result, we do a manifest diff to check. p2mf = mfl[cl.changelogrevision(ps[1]).manifest].read() -needed = any(match(f) for f in curmf.diff(p2mf).iterkeys()) +needed = bool(curmf.diff(p2mf, match)) else: # For a root node, we need to include the node if any # files in the node match the narrowspec. To: martinvonz, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2273: py3: add b'' to test-sshserver.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHG7a46f0735904: py3: add b to test-sshserver.py (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2273?vs=5728=5735 REVISION DETAIL https://phab.mercurial-scm.org/D2273 AFFECTED FILES tests/test-sshserver.py CHANGE DETAILS diff --git a/tests/test-sshserver.py b/tests/test-sshserver.py --- a/tests/test-sshserver.py +++ b/tests/test-sshserver.py @@ -14,12 +14,12 @@ class SSHServerGetArgsTests(unittest.TestCase): def testparseknown(self): tests = [ -('* 0\nnodes 0\n', ['', {}]), -('* 0\nnodes 40\n\n', - ['', {}]), +(b'* 0\nnodes 0\n', [b'', {}]), +(b'* 0\nnodes 40\n\n', + [b'', {}]), ] for input, expected in tests: -self.assertparse('known', input, expected) +self.assertparse(b'known', input, expected) def assertparse(self, cmd, input, expected): server = mockserver(input) To: indygreg, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2203: wireprotoserver: move SSH server operation to a standalone function
durin42 accepted this revision. durin42 added a comment. This revision is now accepted and ready to land. LGTM, but needs rebased REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2203 To: indygreg, #hg-reviewers, durin42 Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1919: phabricator: specify API tokens per host, rather than per repo
durin42 added a comment. Sorry, this slipped through the cracks. If we think we want to start reading .arcconfig, should we just go straight to that and discard our own auth config area, and incur a BC only once? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1919 To: tom.prince, #hg-reviewers, durin42 Cc: quark, indygreg, durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1808: debugcommands: print out the editor that was searched for (post shlexsplit)
durin42 added a comment. This looks good to me - @krbullock should I queue it? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1808 To: spectral, #hg-reviewers, krbullock Cc: durin42, krbullock, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2090: fancyopts: add support for custom multi-arg opts in fancyopts.py
durin42 accepted this revision as: durin42. durin42 added a comment. I _really_ like where this is headed, but will refrain from queueing for now since it's a bit of a conflict of interest. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2090 To: dploch, #hg-reviewers, durin42 Cc: durin42, indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2095: clone: updates the help text for hg clone -r (issue5654) [bugzilla] and hg clone -b
durin42 accepted this revision as: durin42. durin42 added a comment. I can live with this as a strict improvement over what we've got. Anyone object or want to agree with me? (I'm happy to fix the inevitable test changes in flight) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2095 To: sangeet259, #hg-reviewers, durin42 Cc: durin42, joerg.sonnenberger, dlax, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 5 of 5] cmdutil: build "%m" (desc|firstline) in makefilename()
On Wed, Feb 14, 2018 at 11:25:09PM +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara> # Date 1515228297 -32400 > # Sat Jan 06 17:44:57 2018 +0900 > # Node ID 6d899740e9c9e4a2a4459675462ab51170a5c155 > # Parent cd93d1cd0887842c12c3b8f7a3741be3ef338105 > cmdutil: build "%m" (desc|firstline) in makefilename() queued, thanks ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 2] progress: use '%*d' to pad progress value
On Wed, Feb 14, 2018 at 09:56:53PM +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara> # Date 1518611775 -32400 > # Wed Feb 14 21:36:15 2018 +0900 > # Node ID d05d2aa5b8682da65928f0e2fe4a8ece0ed42490 > # Parent bc9daf3da6a6e53331997ea2145a85fd85417e77 > progress: use '%*d' to pad progress value queued, thanks for cleaning up the mess I made (I feel like every few years I learn some new obscure corner of %-formatting. Sigh.) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH V2] dirstate: drop explicit files that shouldn't match (BC) (issue4679)
On Wed, Feb 14, 2018 at 08:58:15PM +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara> # Date 1516963719 -32400 > # Fri Jan 26 19:48:39 2018 +0900 > # Node ID be50b344a4b74614c8979ec3b327183c0336b7b1 > # Parent 7e6aad95244f5e4a66a40efc657012eb9ec5185b > dirstate: drop explicit files that shouldn't match (BC) (issue4679) queued, thanks ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2066: lfs: add a test showing bundle application could be broken
quark added a comment. In https://phab.mercurial-scm.org/D2066#36976, @mharbison72 wrote: > This series worked for me in practice. I assume there's no chance that this lands on stable to help people that are pushing to a repo converted to LFS, but that didn't reclone after converting? That should be fine - there is no need to reclone. But upgrading is needed. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2066 To: quark, #hg-reviewers, indygreg Cc: mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2066: lfs: add a test showing bundle application could be broken
quark updated this revision to Diff 5730. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2066?vs=5326=5730 REVISION DETAIL https://phab.mercurial-scm.org/D2066 AFFECTED FILES tests/drawdag.py tests/test-lfs-bundle.t CHANGE DETAILS diff --git a/tests/test-lfs-bundle.t b/tests/test-lfs-bundle.t new file mode 100644 --- /dev/null +++ b/tests/test-lfs-bundle.t @@ -0,0 +1,100 @@ +In this test, we want to test LFS bundle application on both LFS and non-LFS +repos. + +To make it more interesting, the file revisions will contain hg filelog +metadata ('\1\n'). The bundle will have 1 file revision overlapping with the +destination repo. + +# rev 1 2 3 +# repo:yesyes no +# bundle: no (base) yes yes (deltabase: 2 if possible) + +It is interesting because rev 2 could have been stored as LFS in the repo, and +non-LFS in the bundle; or vice-versa. + +Init + + $ cat >> $HGRCPATH << EOF + > [extensions] + > lfs= + > drawdag=$TESTDIR/drawdag.py + > [lfs] + > url=file:$TESTTMP/lfs-remote + > EOF + +Helper functions + + $ commitxy() { + > hg debugdrawdag "$@" <<'EOS' + > Y # Y/X=\1\n\nE\nF + > | # Y/Y=\1\n\nG\nH + > X # X/X=\1\n\nC\n + > # X/Y=\1\n\nD\n + > EOS + > } + + $ commitz() { + > hg debugdrawdag "$@" <<'EOS' + > Z # Z/X=\1\n\nI\n + > | # Z/Y=\1\n\nJ\n + > | # Z/Z=\1\nZ + > Y + > EOS + > } + + $ enablelfs() { + > cat >> .hg/hgrc < [lfs] + > track=all() + > EOF + > } + +Generate bundles + + $ for i in normal lfs; do + > NAME=src-$i + > hg init $TESTTMP/$NAME + > cd $TESTTMP/$NAME + > [ $i = lfs ] && enablelfs + > commitxy + > commitz + > hg bundle -q --base X -r Y+Z $TESTTMP/$NAME.bundle + > SRCNAMES="$SRCNAMES $NAME" + > done + +Prepare destination repos + + $ for i in normal lfs; do + > NAME=dst-$i + > hg init $TESTTMP/$NAME + > cd $TESTTMP/$NAME + > [ $i = lfs ] && enablelfs + > commitxy + > DSTNAMES="$DSTNAMES $NAME" + > done + +Apply bundles + + $ for i in $SRCNAMES; do + > for j in $DSTNAMES; do + > echo Applying $i.bundle to $j + > cp -R $TESTTMP/$j $TESTTMP/tmp-$i-$j + > cd $TESTTMP/tmp-$i-$j + > if hg unbundle $TESTTMP/$i.bundle -q 2>/dev/null; then + > hg verify -q && echo OK + > else + > echo CRASHED + > fi + > done + > done + Applying src-normal.bundle to dst-normal + OK + Applying src-normal.bundle to dst-lfs + X@2: unpacking bcc7d23fa6b7: integrity check failed on data/X.i:2 + Y@2: unpacking 46017a6640e7: integrity check failed on data/Y.i:2 + 2 integrity errors encountered! + (first damaged changeset appears to be 2) + Applying src-lfs.bundle to dst-normal + CRASHED + Applying src-lfs.bundle to dst-lfs + OK diff --git a/tests/drawdag.py b/tests/drawdag.py --- a/tests/drawdag.py +++ b/tests/drawdag.py @@ -371,7 +371,8 @@ comments = list(_getcomments(text)) filere = re.compile(br'^(\w+)/([\w/]+)\s*=\s*(.*)$', re.M) for name, path, content in filere.findall(b'\n'.join(comments)): -files[name][path] = content.replace(br'\n', b'\n') +content = content.replace(br'\n', b'\n').replace(br'\1', b'\1') +files[name][path] = content committed = {None: node.nullid} # {name: node} To: quark, #hg-reviewers, indygreg Cc: mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2272: py3: add b'' to config options in test extension
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame because just b'' prefixes REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2272 AFFECTED FILES tests/sshprotoext.py CHANGE DETAILS diff --git a/tests/sshprotoext.py b/tests/sshprotoext.py --- a/tests/sshprotoext.py +++ b/tests/sshprotoext.py @@ -22,8 +22,8 @@ configtable = {} configitem = registrar.configitem(configtable) -configitem('sshpeer', 'mode', default=None) -configitem('sshpeer', 'handshake-mode', default=None) +configitem(b'sshpeer', b'mode', default=None) +configitem(b'sshpeer', b'handshake-mode', default=None) class bannerserver(wireprotoserver.sshserver): """Server that sends a banner to stdout.""" To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2273: py3: add b'' to test-sshserver.py
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame because adding b'' prefixes REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2273 AFFECTED FILES tests/test-sshserver.py CHANGE DETAILS diff --git a/tests/test-sshserver.py b/tests/test-sshserver.py --- a/tests/test-sshserver.py +++ b/tests/test-sshserver.py @@ -14,12 +14,12 @@ class SSHServerGetArgsTests(unittest.TestCase): def testparseknown(self): tests = [ -('* 0\nnodes 0\n', ['', {}]), -('* 0\nnodes 40\n\n', - ['', {}]), +(b'* 0\nnodes 0\n', [b'', {}]), +(b'* 0\nnodes 40\n\n', + [b'', {}]), ] for input, expected in tests: -self.assertparse('known', input, expected) +self.assertparse(b'known', input, expected) def assertparse(self, cmd, input, expected): server = mockserver(input) To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2274: py3: stringify integer with %d instead of bytes()
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The unbundle wire protocol command now returns a properly formatted reply in Python 3. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2274 AFFECTED FILES mercurial/wireprotoserver.py CHANGE DETAILS diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -445,7 +445,7 @@ _sshv1respondstream(self._fout, rsp) elif isinstance(rsp, wireprototypes.pushres): _sshv1respondbytes(self._fout, b'') -_sshv1respondbytes(self._fout, bytes(rsp.res)) +_sshv1respondbytes(self._fout, b'%d' % rsp.res) elif isinstance(rsp, wireprototypes.pusherr): _sshv1respondbytes(self._fout, rsp.res) elif isinstance(rsp, wireprototypes.ooberror): To: indygreg, #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] hgweb: show users recorded in obsolescence markers
On Wed, Feb 14, 2018 at 5:41 AM, Anton Shestakovwrote: > # HG changeset patch > # User Anton Shestakov > # Date 1518611552 -28800 > # Wed Feb 14 20:32:32 2018 +0800 > # Node ID 7c6900cc30ee801b782086d98fdcea878eba2bab > # Parent c64b9adfb371b6e9dfd2257d3e2f62d5121341df > hgweb: show users recorded in obsolescence markers > Queued, thanks. FWIW, I'm skeptical that obfuscating via entity codes really matters, as any reasonable web scraper will decode those entities into their string value. But if scrapers are still dumb, then I stand corrected. > > It's useful to see who obsoleted a commit, because it's not always done by > its > author (hg-committed is a good example, because people rebase stacks of > commits > made by various people). > > Usernames are obfuscated, but look correct (e.g. > "" is > "test"). > > diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/ > map > --- a/mercurial/templates/gitweb/map > +++ b/mercurial/templates/gitweb/map > @@ -275,7 +275,8 @@ successorlink = ' > {date|rfc822date} > diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/ > monoblue/map > --- a/mercurial/templates/monoblue/map > +++ b/mercurial/templates/monoblue/map > @@ -233,7 +233,8 @@ successorlink = ' > {date|rfc822date} > diff --git a/mercurial/templates/paper/map b/mercurial/templates/paper/map > --- a/mercurial/templates/paper/map > +++ b/mercurial/templates/paper/map > @@ -213,7 +213,8 @@ successorlink = ' obsfatesuccessors = '{if(successors, ' as ')}{successors%successorlink}' > obsfateverb = '{obsfateverb(successors, markers)}' > obsfateoperations = '{if(obsfateoperations(markers), ' using > {join(obsfateoperations(markers), ', ')}')}' > -obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}' > +obsfateusers = '{if(obsfateusers(markers), ' by > {join(obsfateusers(markers)%'{user|obfuscate}', ', ')}')}' > +obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{ > obsfateusers}' > filediffparent = ' > > parent {rev}: > diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t > --- a/tests/test-obsolete.t > +++ b/tests/test-obsolete.t > @@ -1050,19 +1050,19 @@ check obsolete changeset > title="draft">draft title="obsolete">obsolete >$ get-with-headers.py localhost:$HGPORT > 'log?rev=first(obsolete())=spartan' > | grep 'class="obsolete"' > obsolete: > -pruned > +pruned by > > check an obsolete changeset that has been rewritten >$ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=paper' > | grep rewritten > - rewritten as 3de5eca88c00 > > + rewritten as 3de5eca88c00 > by
D2261: py3: use pycompat.bytestr to convert str to bytes
pulkit updated this revision to Diff 5726. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2261?vs=5701=5726 REVISION DETAIL https://phab.mercurial-scm.org/D2261 AFFECTED FILES mercurial/changelog.py mercurial/ui.py CHANGE DETAILS diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -808,8 +808,8 @@ hint=_("use 'hg config --edit' " 'to set your username')) if "\n" in user: -raise error.Abort(_("username %s contains a newline\n") - % repr(user)) +raise error.Abort(_("username %r contains a newline\n") + % pycompat.bytestr(user)) return user def shortuser(self, user): diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -20,6 +20,7 @@ from . import ( encoding, error, +pycompat, revlog, util, ) @@ -517,8 +518,8 @@ if not user: raise error.RevlogError(_("empty username")) if "\n" in user: -raise error.RevlogError(_("username %s contains a newline") -% repr(user)) +raise error.RevlogError(_("username %r contains a newline") +% pycompat.bytestr(user)) desc = stripdesc(desc) To: pulkit, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2269: py3: use util.forcebytestr instead of str for converting errors to bytes
pulkit updated this revision to Diff 5725. pulkit retitled this revision from "py3: use pycompat.bytestr instead of str for converting errors to bytes" to "py3: use util.forcebytestr instead of str for converting errors to bytes". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2269?vs=5709=5725 REVISION DETAIL https://phab.mercurial-scm.org/D2269 AFFECTED FILES hgext/transplant.py mercurial/patch.py CHANGE DETAILS diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1459,7 +1459,7 @@ dec.append(util.b85decode(line[1:])[:l]) except ValueError as e: raise PatchError(_('could not decode "%s" binary patch: %s') - % (self._fname, str(e))) + % (self._fname, util.forcebytestr(e))) line = getline(lr, self.hunk) text = zlib.decompress(''.join(dec)) if len(text) != size: diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -311,7 +311,7 @@ p1 = repo.dirstate.p1() p2 = node self.log(user, date, message, p1, p2, merge=merge) -self.ui.write(str(inst) + '\n') +self.ui.write(util.forcebytestr(inst) + '\n') raise TransplantError(_('fix up the working directory and run ' 'hg transplant --continue')) else: To: pulkit, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH hglib v2] client: ignore close() on non-open clients (issue5751)
# HG changeset patch # User Gábor Stefanik# Date 1518443649 -3600 # Mon Feb 12 14:54:09 2018 +0100 # Node ID b5d05859a5d7956024b169dd7fe53a6ea45a4d67 # Parent 1085c904d8c04d51c6897027fe9c7bae0964b64b client: ignore close() on non-open clients (issue5751) Closing a client twice currently triggers a rather confusing exception. Instead, follow the convention set by Python's file objects, and ignore close() commands on non-open clients. diff -r 1085c904d8c0 -r b5d05859a5d7 hglib/client.py --- a/hglib/client.py Thu Feb 01 15:10:02 2018 -0500 +++ b/hglib/client.py Mon Feb 12 14:54:09 2018 +0100 @@ -291,6 +291,8 @@ Attempting to call any function afterwards that needs to communicate with the server will raise a ValueError. """ +if not self.server: +return 0 return self._close()[0] def _close(self): This message, including its attachments, is confidential and the property of NNG Llc. For more information please read NNG's email policy here: https://www.nng.com/email-policy/ By responding to this email you accept the email policy. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 5 of 5] cmdutil: build "%m" (desc|firstline) in makefilename()
# HG changeset patch # User Yuya Nishihara# Date 1515228297 -32400 # Sat Jan 06 17:44:57 2018 +0900 # Node ID 6d899740e9c9e4a2a4459675462ab51170a5c155 # Parent cd93d1cd0887842c12c3b8f7a3741be3ef338105 cmdutil: build "%m" (desc|firstline) in makefilename() diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -891,13 +891,14 @@ def getcommiteditor(edit=False, finishde else: return commiteditor -def makefilename(ctx, pat, desc=None, +def makefilename(ctx, pat, total=None, seqno=None, revwidth=None, pathname=None): expander = { 'H': lambda: ctx.hex(), 'R': lambda: '%d' % ctx.rev(), 'h': lambda: short(ctx.node()), -'m': lambda: re.sub('[^\w]', '_', desc or ''), +'m': lambda: re.sub('[^\w]', '_', +ctx.description().rstrip().splitlines()[0]), 'r': lambda: ('%d' % ctx.rev()).zfill(revwidth or 0), '%': lambda: '%', 'b': lambda: os.path.basename(ctx.repo().root), @@ -954,7 +955,7 @@ class _unclosablefile(object): def __exit__(self, exc_type, exc_value, exc_tb): pass -def makefileobj(ctx, pat, desc=None, total=None, +def makefileobj(ctx, pat, total=None, seqno=None, revwidth=None, mode='wb', modemap=None, pathname=None): @@ -967,7 +968,7 @@ def makefileobj(ctx, pat, desc=None, tot else: fp = repo.ui.fin return _unclosablefile(fp) -fn = makefilename(ctx, pat, desc, total, seqno, revwidth, pathname) +fn = makefilename(ctx, pat, total, seqno, revwidth, pathname) if modemap is not None: mode = modemap.get(fn, mode) if mode == 'wb': @@ -1542,9 +1543,7 @@ def export(repo, revs, fntemplate='hg-%h ctx = repo[rev] fo = None if not fp and fntemplate: -desc_lines = ctx.description().rstrip().split('\n') -desc = desc_lines[0]#Commit always has a first line. -fo = makefileobj(ctx, fntemplate, desc=desc, +fo = makefileobj(ctx, fntemplate, total=total, seqno=seqno, revwidth=revwidth, mode='wb', modemap=filemode) dest = fo.name ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 4 of 5] cmdutil: rewrite makefilename() to use ctx methods
# HG changeset patch # User Yuya Nishihara# Date 1427985427 -32400 # Thu Apr 02 23:37:07 2015 +0900 # Node ID cd93d1cd0887842c12c3b8f7a3741be3ef338105 # Parent f45bd2b2fa1ec9b4cd41c00ab5d2d2f1872461ef cmdutil: rewrite makefilename() to use ctx methods diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -893,16 +893,14 @@ def getcommiteditor(edit=False, finishde def makefilename(ctx, pat, desc=None, total=None, seqno=None, revwidth=None, pathname=None): -repo = ctx.repo() -node = ctx.node() expander = { -'H': lambda: hex(node), -'R': lambda: '%d' % repo.changelog.rev(node), -'h': lambda: short(node), +'H': lambda: ctx.hex(), +'R': lambda: '%d' % ctx.rev(), +'h': lambda: short(ctx.node()), 'm': lambda: re.sub('[^\w]', '_', desc or ''), -'r': lambda: ('%d' % repo.changelog.rev(node)).zfill(revwidth or 0), +'r': lambda: ('%d' % ctx.rev()).zfill(revwidth or 0), '%': lambda: '%', -'b': lambda: os.path.basename(repo.root), +'b': lambda: os.path.basename(ctx.repo().root), } try: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 5] cmdutil: make node parameter of makefileobj() mandatory (API)
# HG changeset patch # User Yuya Nishihara# Date 1427984522 -32400 # Thu Apr 02 23:22:02 2015 +0900 # Node ID 87127b53c63a948b24461862e6d7a02862ecdaa2 # Parent 39b3aab6231e8fa070eadd8e165b9960f8c46076 cmdutil: make node parameter of makefileobj() mandatory (API) (repo, node) pair will be replaced with ctx, so makefilename() can be easily ported to templater. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -893,23 +893,17 @@ def getcommiteditor(edit=False, finishde def makefilename(repo, pat, node, desc=None, total=None, seqno=None, revwidth=None, pathname=None): -node_expander = { +expander = { 'H': lambda: hex(node), 'R': lambda: '%d' % repo.changelog.rev(node), 'h': lambda: short(node), -'m': lambda: re.sub('[^\w]', '_', desc or '') -} -expander = { +'m': lambda: re.sub('[^\w]', '_', desc or ''), +'r': lambda: ('%d' % repo.changelog.rev(node)).zfill(revwidth or 0), '%': lambda: '%', 'b': lambda: os.path.basename(repo.root), } try: -if node: -expander.update(node_expander) -if node: -expander['r'] = (lambda: -('%d' % repo.changelog.rev(node)).zfill(revwidth or 0)) if total is not None: expander['N'] = lambda: '%d' % total if seqno is not None: @@ -960,7 +954,7 @@ class _unclosablefile(object): def __exit__(self, exc_type, exc_value, exc_tb): pass -def makefileobj(repo, pat, node=None, desc=None, total=None, +def makefileobj(repo, pat, node, desc=None, total=None, seqno=None, revwidth=None, mode='wb', modemap=None, pathname=None): diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -486,7 +486,7 @@ def archive(ui, repo, dest, **opts): if dest == '-': if kind == 'files': raise error.Abort(_('cannot archive plain files to stdout')) -dest = cmdutil.makefileobj(repo, dest) +dest = cmdutil.makefileobj(repo, dest, node) if not prefix: prefix = os.path.basename(repo.root) + '-%h' ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 5] cmdutil: pass ctx to makefileobj() in place of repo/node pair (API)
# HG changeset patch # User Yuya Nishihara# Date 1427984896 -32400 # Thu Apr 02 23:28:16 2015 +0900 # Node ID f45bd2b2fa1ec9b4cd41c00ab5d2d2f1872461ef # Parent 8798e4243a204bfd2f19373abf6bddd9fdb0b155 cmdutil: pass ctx to makefileobj() in place of repo/node pair (API) diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1359,8 +1359,7 @@ def overridecat(orig, ui, repo, file1, * m.visitdir = lfvisitdirfn for f in ctx.walk(m): -with cmdutil.makefileobj(repo, opts.get('output'), ctx.node(), - pathname=f) as fp: +with cmdutil.makefileobj(ctx, opts.get('output'), pathname=f) as fp: lf = lfutil.splitstandin(f) if lf is None or origmatchfn(f): # duplicating unreachable code from commands.cat diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -956,19 +956,19 @@ class _unclosablefile(object): def __exit__(self, exc_type, exc_value, exc_tb): pass -def makefileobj(repo, pat, node, desc=None, total=None, +def makefileobj(ctx, pat, desc=None, total=None, seqno=None, revwidth=None, mode='wb', modemap=None, pathname=None): writable = mode not in ('r', 'rb') if isstdiofilename(pat): +repo = ctx.repo() if writable: fp = repo.ui.fout else: fp = repo.ui.fin return _unclosablefile(fp) -ctx = repo[node] fn = makefilename(ctx, pat, desc, total, seqno, revwidth, pathname) if modemap is not None: mode = modemap.get(fn, mode) @@ -1546,7 +1546,7 @@ def export(repo, revs, fntemplate='hg-%h if not fp and fntemplate: desc_lines = ctx.description().rstrip().split('\n') desc = desc_lines[0]#Commit always has a first line. -fo = makefileobj(repo, fntemplate, ctx.node(), desc=desc, +fo = makefileobj(ctx, fntemplate, desc=desc, total=total, seqno=seqno, revwidth=revwidth, mode='wb', modemap=filemode) dest = fo.name diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -486,7 +486,7 @@ def archive(ui, repo, dest, **opts): if dest == '-': if kind == 'files': raise error.Abort(_('cannot archive plain files to stdout')) -dest = cmdutil.makefileobj(repo, dest, node) +dest = cmdutil.makefileobj(ctx, dest) if not prefix: prefix = os.path.basename(repo.root) + '-%h' diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -1642,8 +1642,7 @@ class gitsubrepo(abstractsubrepo): # TODO: add support for non-plain formatter (see cmdutil.cat()) for f in match.files(): output = self._gitcommand(["show", "%s:%s" % (rev, f)]) -fp = cmdutil.makefileobj(self._subparent, fntemplate, - self._ctx.node(), +fp = cmdutil.makefileobj(self._ctx, fntemplate, pathname=self.wvfs.reljoin(prefix, f)) fp.write(output) fp.close() ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 5] cmdutil: pass ctx to makefilename() in place of repo/node pair (API)
# HG changeset patch # User Yuya Nishihara# Date 1427985148 -32400 # Thu Apr 02 23:32:28 2015 +0900 # Node ID 8798e4243a204bfd2f19373abf6bddd9fdb0b155 # Parent 87127b53c63a948b24461862e6d7a02862ecdaa2 cmdutil: pass ctx to makefilename() in place of repo/node pair (API) diff --git a/hgext/extdiff.py b/hgext/extdiff.py --- a/hgext/extdiff.py +++ b/hgext/extdiff.py @@ -256,8 +256,8 @@ def dodiff(ui, repo, cmdline, pats, opts cmdutil.export(repo, [repo[node1a].rev(), repo[node2].rev()], fntemplate=repo.vfs.reljoin(tmproot, template), match=matcher) -label1a = cmdutil.makefilename(repo, template, node1a) -label2 = cmdutil.makefilename(repo, template, node2) +label1a = cmdutil.makefilename(repo[node1a], template) +label2 = cmdutil.makefilename(repo[node2], template) dir1a = repo.vfs.reljoin(tmproot, label1a) dir2 = repo.vfs.reljoin(tmproot, label2) dir1b = None diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -265,11 +265,10 @@ def makepatch(ui, repo, rev, patchlines, if patchtags: patchname = patchtags[0] elif total > 1: -patchname = cmdutil.makefilename(repo, '%b-%n.patch', - binnode, seqno=idx, - total=total) +patchname = cmdutil.makefilename(repo[node], '%b-%n.patch', + seqno=idx, total=total) else: -patchname = cmdutil.makefilename(repo, '%b.patch', binnode) +patchname = cmdutil.makefilename(repo[node], '%b.patch') disposition = 'inline' if opts.get('attach'): disposition = 'attachment' diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -891,8 +891,10 @@ def getcommiteditor(edit=False, finishde else: return commiteditor -def makefilename(repo, pat, node, desc=None, +def makefilename(ctx, pat, desc=None, total=None, seqno=None, revwidth=None, pathname=None): +repo = ctx.repo() +node = ctx.node() expander = { 'H': lambda: hex(node), 'R': lambda: '%d' % repo.changelog.rev(node), @@ -966,7 +968,8 @@ def makefileobj(repo, pat, node, desc=No else: fp = repo.ui.fin return _unclosablefile(fp) -fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname) +ctx = repo[node] +fn = makefilename(ctx, pat, desc, total, seqno, revwidth, pathname) if modemap is not None: mode = modemap.get(fn, mode) if mode == 'wb': @@ -2163,7 +2166,7 @@ def cat(ui, repo, ctx, matcher, basefm, def write(path): filename = None if fntemplate: -filename = makefilename(repo, fntemplate, ctx.node(), +filename = makefilename(ctx, fntemplate, pathname=os.path.join(prefix, path)) # attempt to create the directory if it does not already exist try: diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -476,7 +476,7 @@ def archive(ui, repo, dest, **opts): if not ctx: raise error.Abort(_('no working directory: please specify a revision')) node = ctx.node() -dest = cmdutil.makefilename(repo, dest, node) +dest = cmdutil.makefilename(ctx, dest) if os.path.realpath(dest) == repo.root: raise error.Abort(_('repository root cannot be destination')) @@ -490,7 +490,7 @@ def archive(ui, repo, dest, **opts): if not prefix: prefix = os.path.basename(repo.root) + '-%h' -prefix = cmdutil.makefilename(repo, prefix, node) +prefix = cmdutil.makefilename(ctx, prefix) match = scmutil.match(ctx, [], opts) archival.archive(repo, dest, node, kind, not opts.get('no_decode'), match, prefix, subrepos=opts.get('subrepos')) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 2 v2] revert: use an exact matcher in interactive diff selection (issue5789)
On Wed, 14 Feb 2018 14:15:21 +0100, Denis Laxalde wrote: > # HG changeset patch > # User Denis Laxalde> # Date 1518613925 -3600 > # Wed Feb 14 14:12:05 2018 +0100 > # Node ID 6b505da3e8351e945b0e71a65870cbe2578b99ae > # Parent 75a4598a4375d80d240c19625e2c43a069ba9618 > # Available At http://hg.logilab.org/users/dlaxalde/hg > # hg pull http://hg.logilab.org/users/dlaxalde/hg -r 6b505da3e835 > # EXP-Topic revert-interactive-pats > revert: use an exact matcher in interactive diff selection (issue5789) Queued, thanks. > -torevert = [repo.wjoin(f) for f in actions['revert'][0]] > -m = scmutil.match(ctx, torevert, matcher_opts) > +torevert = (f for f in actions['revert'][0] if f not in > excluded_files) Changed this to a list, which is probably safer than passing an iterator to matchmod. > +m = scmutil.matchfiles(repo, torevert) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2264: py3: use pycompat.bytestr instead of str
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc1628a5eac87: py3: use pycompat.bytestr instead of str (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2264?vs=5704=5718 REVISION DETAIL https://phab.mercurial-scm.org/D2264 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -337,8 +337,8 @@ ('number', ' ', lambda x: x.fctx.rev(), formatrev), ('changeset', ' ', lambda x: hexfn(x.fctx.node()), formathex), ('date', ' ', lambda x: x.fctx.date(), util.cachefunc(datefunc)), - ('file', ' ', lambda x: x.fctx.path(), str), - ('line_number', ':', lambda x: x.lineno, str), + ('file', ' ', lambda x: x.fctx.path(), pycompat.bytestr), + ('line_number', ':', lambda x: x.lineno, pycompat.bytestr), ] fieldnamemap = {'number': 'rev', 'changeset': 'node'} To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2271: py3: slice over bytes to prevent getting ascii values
This revision was automatically updated to reflect the committed changes. Closed by commit rHGeb91ffdaaece: py3: slice over bytes to prevent getting ascii values (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2271?vs=5711=5724 REVISION DETAIL https://phab.mercurial-scm.org/D2271 AFFECTED FILES mercurial/patch.py CHANGE DETAILS diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1450,7 +1450,7 @@ dec = [] line = getline(lr, self.hunk) while len(line) > 1: -l = line[0] +l = line[0:1] if l <= 'Z' and l >= 'A': l = ord(l) - ord('A') + 1 else: To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2263: py3: use "%d" to convert integers to bytes
This revision was automatically updated to reflect the committed changes. Closed by commit rHGacc8e6e52af6: py3: use %d to convert integers to bytes (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2263?vs=5703=5717 REVISION DETAIL https://phab.mercurial-scm.org/D2263 AFFECTED FILES hgext/rebase.py hgext/shelve.py mercurial/verify.py CHANGE DETAILS diff --git a/mercurial/verify.py b/mercurial/verify.py --- a/mercurial/verify.py +++ b/mercurial/verify.py @@ -60,6 +60,7 @@ def err(self, linkrev, msg, filename=None): if linkrev is not None: self.badrevs.add(linkrev) +linkrev = "%d" % linkrev else: linkrev = '?' msg = "%s: %s" % (linkrev, msg) diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -271,7 +271,7 @@ "activebook": activebook or cls._noactivebook } scmutil.simplekeyvaluefile(repo.vfs, cls._filename)\ - .write(info, firstline=str(cls._version)) + .write(info, firstline=("%d" % cls._version)) @classmethod def clear(cls, repo): diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -541,7 +541,7 @@ 'to commit\n') % (rev, ctx)) self.skipped.add(rev) self.state[rev] = p1 -ui.debug('next revision set to %s\n' % p1) +ui.debug('next revision set to %d\n' % p1) else: ui.status(_('already rebased %s as %s\n') % (desc, repo[self.state[rev]])) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2258: py3: add b'' prefixes in test-worker.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4f0439981a8a: py3: add b prefixes in test-worker.t (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2258?vs=5698=5714 REVISION DETAIL https://phab.mercurial-scm.org/D2258 AFFECTED FILES tests/test-worker.t CHANGE DETAILS diff --git a/tests/test-worker.t b/tests/test-worker.t --- a/tests/test-worker.t +++ b/tests/test-worker.t @@ -12,34 +12,34 @@ > def abort(ui, args): > if args[0] == 0: > # by first worker for test stability - > raise error.Abort('known exception') + > raise error.Abort(b'known exception') > return runme(ui, []) > def exc(ui, args): > if args[0] == 0: > # by first worker for test stability > raise Exception('unknown exception') > return runme(ui, []) > def runme(ui, args): > for arg in args: - > ui.status('run\n') + > ui.status(b'run\n') > yield 1, arg > time.sleep(0.1) # easier to trigger killworkers code path > functable = { - > 'abort': abort, - > 'exc': exc, - > 'runme': runme, + > b'abort': abort, + > b'exc': exc, + > b'runme': runme, > } > cmdtable = {} > command = registrar.command(cmdtable) - > @command(b'test', [], 'hg test [COST] [FUNC]') - > def t(ui, repo, cost=1.0, func='runme'): + > @command(b'test', [], b'hg test [COST] [FUNC]') + > def t(ui, repo, cost=1.0, func=b'runme'): > cost = float(cost) > func = functable[func] - > ui.status('start\n') + > ui.status(b'start\n') > runs = worker.worker(ui, cost, func, (ui,), range(8)) > for n, i in runs: > pass - > ui.status('done\n') + > ui.status(b'done\n') > EOF $ abspath=`pwd`/t.py $ hg init To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2256: py3: slice over bytes to prevent getting ascii values
This revision was automatically updated to reflect the committed changes. Closed by commit rHG34e850440271: py3: slice over bytes to prevent getting ascii values (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2256?vs=5696=5712 REVISION DETAIL https://phab.mercurial-scm.org/D2256 AFFECTED FILES mercurial/graphmod.py mercurial/hgweb/webutil.py CHANGE DETAILS diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -619,7 +619,7 @@ websubdefs += repo.ui.configitems('interhg') for key, pattern in websubdefs: # grab the delimiter from the character after the "s" -unesc = pattern[1] +unesc = pattern[1:2] delim = re.escape(unesc) # identify portions of the pattern, taking care to avoid escaped diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py --- a/mercurial/graphmod.py +++ b/mercurial/graphmod.py @@ -454,16 +454,16 @@ if any(len(char) > 1 for char in edgemap.values()): # limit drawing an edge to the first or last N lines of the current # section the rest of the edge is drawn like a parent line. -parent = state['styles'][PARENT][-1] +parent = state['styles'][PARENT][-1:] def _drawgp(char, i): # should a grandparent character be drawn for this line? if len(char) < 2: return True num = int(char[:-1]) # either skip first num lines or take last num lines, based on sign return -num <= i if num < 0 else (len(lines) - i) <= num for i, line in enumerate(lines): -line[:] = [c[-1] if _drawgp(c, i) else parent for c in line] +line[:] = [c[-1:] if _drawgp(c, i) else parent for c in line] edgemap.update( (e, (c if len(c) < 2 else parent)) for e, c in edgemap.items()) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2267: py3: replace file() with open() in transplant.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2f309b8846cf: py3: replace file() with open() in transplant.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2267?vs=5707=5721 REVISION DETAIL https://phab.mercurial-scm.org/D2267 AFFECTED FILES hgext/transplant.py CHANGE DETAILS diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -274,7 +274,7 @@ }, onerr=error.Abort, errprefix=_('filter failed'), blockedtag='transplant_filter') -user, date, msg = self.parselog(file(headerfile))[1:4] +user, date, msg = self.parselog(open(headerfile, 'rb'))[1:4] finally: os.unlink(headerfile) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2270: py3: converts bytes to pycompat.bytestr to get bytechrs while enumerating
This revision was automatically updated to reflect the committed changes. Closed by commit rHG80301c90a2dc: py3: converts bytes to pycompat.bytestr to get bytechrs while enumerating (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2270?vs=5710=5723 REVISION DETAIL https://phab.mercurial-scm.org/D2270 AFFECTED FILES mercurial/pure/base85.py CHANGE DETAILS diff --git a/mercurial/pure/base85.py b/mercurial/pure/base85.py --- a/mercurial/pure/base85.py +++ b/mercurial/pure/base85.py @@ -53,6 +53,7 @@ out = [] for i in range(0, len(text), 5): chunk = text[i:i + 5] +chunk = pycompat.bytestr(chunk) acc = 0 for j, c in enumerate(chunk): try: To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2265: py3: open files in bytes mode in transplant.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa9d1ac7b91a8: py3: open files in bytes mode in transplant.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2265?vs=5705=5719 REVISION DETAIL https://phab.mercurial-scm.org/D2265 AFFECTED FILES hgext/transplant.py CHANGE DETAILS diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -211,7 +211,7 @@ patchfile = None else: fd, patchfile = tempfile.mkstemp(prefix='hg-transplant-') -fp = os.fdopen(fd, pycompat.sysstr('w')) +fp = os.fdopen(fd, pycompat.sysstr('wb')) gen = patch.diff(source, parent, node, opts=diffopts) for chunk in gen: fp.write(chunk) @@ -259,7 +259,7 @@ self.ui.status(_('filtering %s\n') % patchfile) user, date, msg = (changelog[1], changelog[2], changelog[4]) fd, headerfile = tempfile.mkstemp(prefix='hg-transplant-') -fp = os.fdopen(fd, pycompat.sysstr('w')) +fp = os.fdopen(fd, pycompat.sysstr('wb')) fp.write("# HG changeset patch\n") fp.write("# User %s\n" % user) fp.write("# Date %d %d\n" % date) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2268: py3: use pycompat.{bytes|str}kwargs in transplant.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHG7fda2a8ed24e: py3: use pycompat.{bytes|str}kwargs in transplant.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2268?vs=5708=5722 REVISION DETAIL https://phab.mercurial-scm.org/D2268 AFFECTED FILES hgext/transplant.py CHANGE DETAILS diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -120,7 +120,8 @@ opener=self.opener) def getcommiteditor(): editform = cmdutil.mergeeditform(repo[None], 'transplant') -return cmdutil.getcommiteditor(editform=editform, **opts) +return cmdutil.getcommiteditor(editform=editform, + **pycompat.strkwargs(opts)) self.getcommiteditor = getcommiteditor def applied(self, repo, node, parent): @@ -647,6 +648,7 @@ raise error.Abort(_('--all is incompatible with a ' 'revision list')) +opts = pycompat.byteskwargs(opts) checkopts(opts, revs) if not opts.get('log'): To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2266: py3: use "%d" for converting int to bytes in transplant.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4e33aa8639d0: py3: use %d for converting int to bytes in transplant.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2266?vs=5706=5720 REVISION DETAIL https://phab.mercurial-scm.org/D2266 AFFECTED FILES hgext/transplant.py CHANGE DETAILS diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -161,7 +161,7 @@ tr = repo.transaction('transplant') for rev in revs: node = revmap[rev] -revstr = '%s:%s' % (rev, nodemod.short(node)) +revstr = '%d:%s' % (rev, nodemod.short(node)) if self.applied(repo, node, p1): self.ui.warn(_('skipping already applied revision %s\n') % @@ -195,7 +195,7 @@ skipmerge = False if parents[1] != revlog.nullid: if not opts.get('parent'): -self.ui.note(_('skipping merge changeset %s:%s\n') +self.ui.note(_('skipping merge changeset %d:%s\n') % (rev, nodemod.short(node))) skipmerge = True else: To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2260: py3: add b'' to make sure regex pattern are bytes in hgweb/webutil.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHG44a519ec5077: py3: add b to make sure regex pattern are bytes in hgweb/webutil.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2260?vs=5700=5715 REVISION DETAIL https://phab.mercurial-scm.org/D2260 AFFECTED FILES mercurial/hgweb/webutil.py CHANGE DETAILS diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -626,15 +626,15 @@ # delimiters. the replace format and flags are optional, but # delimiters are required. match = re.match( -r'^s%s(.+)(?:(?<=)|(?https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2262: py3: add couple of missing b'' in fakemergerecord.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHG56635c506608: py3: add couple of missing b in fakemergerecord.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2262?vs=5702=5716 REVISION DETAIL https://phab.mercurial-scm.org/D2262 AFFECTED FILES tests/fakemergerecord.py CHANGE DETAILS diff --git a/tests/fakemergerecord.py b/tests/fakemergerecord.py --- a/tests/fakemergerecord.py +++ b/tests/fakemergerecord.py @@ -19,8 +19,8 @@ with repo.wlock(): ms = merge.mergestate.read(repo) records = ms._makerecords() -if opts.get('mandatory'): +if opts.get(b'mandatory'): records.append((b'X', b'mandatory record')) -if opts.get('advisory'): +if opts.get(b'advisory'): records.append((b'x', b'advisory record')) ms._writerecords(records) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2257: py3: add b'' prefixes to make printrevset.py work in test-glog.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHGf1addba385e5: py3: add b prefixes to make printrevset.py work in test-glog.t (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2257?vs=5697=5713 REVISION DETAIL https://phab.mercurial-scm.org/D2257 AFFECTED FILES tests/test-glog.t CHANGE DETAILS diff --git a/tests/test-glog.t b/tests/test-glog.t --- a/tests/test-glog.t +++ b/tests/test-glog.t @@ -102,23 +102,23 @@ > def uisetup(ui): > def printrevset(orig, repo, pats, opts): > revs, filematcher = orig(repo, pats, opts) - > if opts.get('print_revset'): + > if opts.get(b'print_revset'): > expr = logrevset(repo, pats, opts) > if expr: > tree = revsetlang.parse(expr) > tree = revsetlang.analyze(tree) > else: > tree = [] > ui = repo.ui - > ui.write('%r\n' % (opts.get('rev', []),)) - > ui.write(revsetlang.prettyformat(tree) + '\n') - > ui.write(smartset.prettyformat(revs) + '\n') + > ui.write(b'%r\n' % (opts.get(b'rev', []),)) + > ui.write(revsetlang.prettyformat(tree) + b'\n') + > ui.write(smartset.prettyformat(revs) + b'\n') > revs = smartset.baseset() # display no revisions > return revs, filematcher > extensions.wrapfunction(logcmdutil, 'getrevs', printrevset) - > aliases, entry = cmdutil.findcmd('log', commands.table) - > entry[1].append(('', 'print-revset', False, - > 'print generated revset and exit (DEPRECATED)')) + > aliases, entry = cmdutil.findcmd(b'log', commands.table) + > entry[1].append((b'', b'print-revset', False, + > b'print generated revset and exit (DEPRECATED)')) > EOF $ echo "[extensions]" >> $HGRCPATH To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] hgweb: show users recorded in obsolescence markers
# HG changeset patch # User Anton Shestakov# Date 1518611552 -28800 # Wed Feb 14 20:32:32 2018 +0800 # Node ID 7c6900cc30ee801b782086d98fdcea878eba2bab # Parent c64b9adfb371b6e9dfd2257d3e2f62d5121341df hgweb: show users recorded in obsolescence markers It's useful to see who obsoleted a commit, because it's not always done by its author (hg-committed is a good example, because people rebase stacks of commits made by various people). Usernames are obfuscated, but look correct (e.g. "" is "test"). diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map --- a/mercurial/templates/gitweb/map +++ b/mercurial/templates/gitweb/map @@ -275,7 +275,8 @@ successorlink = ' {date|rfc822date} diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map --- a/mercurial/templates/monoblue/map +++ b/mercurial/templates/monoblue/map @@ -233,7 +233,8 @@ successorlink = ' {date|rfc822date} diff --git a/mercurial/templates/paper/map b/mercurial/templates/paper/map --- a/mercurial/templates/paper/map +++ b/mercurial/templates/paper/map @@ -213,7 +213,8 @@ successorlink = 'obsolete: -pruned +pruned by check an obsolete changeset that has been rewritten $ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=paper' | grep rewritten - rewritten as 3de5eca88c00 + rewritten as 3de5eca88c00 by $ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=coal' | grep rewritten - rewritten as 3de5eca88c00 + rewritten as 3de5eca88c00 by $ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=gitweb' | grep rewritten - obsoleterewritten as 3de5eca88c00 + obsoleterewritten as 3de5eca88c00 by $ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=monoblue' | grep rewritten - obsoleterewritten as 3de5eca88c00 + obsoleterewritten as 3de5eca88c00 by $ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=spartan' | grep rewritten - rewritten as 3de5eca88c00 + rewritten as 3de5eca88c00 by check changeset with instabilities ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2269: py3: use pycompat.bytestr instead of str for converting errors to bytes
yuja requested changes to this revision. yuja added inline comments. This revision now requires changes to proceed. INLINE COMMENTS > transplant.py:314 > self.log(user, date, message, p1, p2, merge=merge) > -self.ui.write(str(inst) + '\n') > +self.ui.write(pycompat.bytestr(inst) + '\n') > raise TransplantError(_('fix up the working directory and > run ' Use `util.forcebytestr()` to stringify an exception object of unknown encoding. > patch.py:1462 > raise PatchError(_('could not decode "%s" binary patch: %s') > - % (self._fname, str(e))) > + % (self._fname, pycompat.bytestr(e))) > line = getline(lr, self.hunk) Here `bytestr()` is probably fine, but could be `forcebytestr()`, too. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2269 To: pulkit, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2 v2] tests: add a test demonstrate that 'revert -i' ignores nonexistent patterns
# HG changeset patch # User Denis Laxalde# Date 1518377864 -3600 # Sun Feb 11 20:37:44 2018 +0100 # Node ID 75a4598a4375d80d240c19625e2c43a069ba9618 # Parent 62a428bf63590f74024c6cc6c40b4178be086cc4 # Available At http://hg.logilab.org/users/dlaxalde/hg # hg pull http://hg.logilab.org/users/dlaxalde/hg -r 75a4598a4375 # EXP-Topic revert-interactive-pats tests: add a test demonstrate that 'revert -i' ignores nonexistent patterns As described in issue5789, when revert is called through: hg revert -i we'd expect the command to abort early. Currently, it just warns about missing file but prompt about files unrelated to user arguments. diff --git a/tests/test-revert-interactive.t b/tests/test-revert-interactive.t --- a/tests/test-revert-interactive.t +++ b/tests/test-revert-interactive.t @@ -420,4 +420,17 @@ When a line without EOL is selected duri $ cat a 0 +When specified pattern does not exist, we should exit early (issue5789). + + $ hg files + a + $ hg rev b + b: no such file in rev b40d1912accf + $ hg rev -i b + b: no such file in rev b40d1912accf + diff --git a/a b/a + 1 hunks, 1 lines changed + examine changes to 'a'? [Ynesfdaq?] abort: response expected + [255] + $ cd .. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2 v2] revert: use an exact matcher in interactive diff selection (issue5789)
# HG changeset patch # User Denis Laxalde# Date 1518613925 -3600 # Wed Feb 14 14:12:05 2018 +0100 # Node ID 6b505da3e8351e945b0e71a65870cbe2578b99ae # Parent 75a4598a4375d80d240c19625e2c43a069ba9618 # Available At http://hg.logilab.org/users/dlaxalde/hg # hg pull http://hg.logilab.org/users/dlaxalde/hg -r 6b505da3e835 # EXP-Topic revert-interactive-pats revert: use an exact matcher in interactive diff selection (issue5789) When going through _performrevert() in the interactive case, we build a matcher with files to revert and pass it patch.diff() for later selection of diff hunks to revert. The files set used to build the matcher comes from dirstate and accounts for patterns explicitly passed to revert ('hg revert -i ') and, in case of nonexistent pattern, this set is empty (which is expected). Unfortunately, the matcher built from scmutil.match(ctx, []) is wrong as it leads patch.diff() to rebuild a 'changes' tuple with dirstate information, ignoring user-specified pattern. This leads to the situation described in issue5789, where one gets prompted about reverting files unrelated to specified patterns because they made a typo or so. We fix this by building an exact matcher with the correct set of file paths (built earlier). Thanks to Yuya Nishihara for suggesting the correct fix. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2906,7 +2906,6 @@ def _performrevert(repo, parents, ctx, a parent, p2 = parents node = ctx.node() excluded_files = [] -matcher_opts = {"exclude": excluded_files} def checkout(f): fc = ctx[f] @@ -2927,7 +2926,7 @@ def _performrevert(repo, parents, ctx, a if choice == 0: repo.dirstate.drop(f) else: -excluded_files.append(repo.wjoin(f)) +excluded_files.append(f) else: repo.dirstate.drop(f) for f in actions['remove'][0]: @@ -2938,7 +2937,7 @@ def _performrevert(repo, parents, ctx, a if choice == 0: doremove(f) else: -excluded_files.append(repo.wjoin(f)) +excluded_files.append(f) else: doremove(f) for f in actions['drop'][0]: @@ -2958,8 +2957,8 @@ def _performrevert(repo, parents, ctx, a newlyaddedandmodifiedfiles = set() if interactive: # Prompt the user for changes to revert -torevert = [repo.wjoin(f) for f in actions['revert'][0]] -m = scmutil.match(ctx, torevert, matcher_opts) +torevert = (f for f in actions['revert'][0] if f not in excluded_files) +m = scmutil.matchfiles(repo, torevert) diffopts = patch.difffeatureopts(repo.ui, whitespace=True) diffopts.nodates = True diffopts.git = True diff --git a/tests/test-revert-interactive.t b/tests/test-revert-interactive.t --- a/tests/test-revert-interactive.t +++ b/tests/test-revert-interactive.t @@ -428,9 +428,5 @@ When specified pattern does not exist, w b: no such file in rev b40d1912accf $ hg rev -i b b: no such file in rev b40d1912accf - diff --git a/a b/a - 1 hunks, 1 lines changed - examine changes to 'a'? [Ynesfdaq?] abort: response expected - [255] $ cd .. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2261: py3: use pycompat.bytestr to convert str to bytes
yuja requested changes to this revision. yuja added a comment. This revision now requires changes to proceed. Here `'%r' % pycompat.bytestr(user)` is preferred since repr(user) would leave `b''` prefix in error message. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2261 To: pulkit, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2259: py3: use pycompat.bytestr to convert int/bytes to bytes
yuja requested changes to this revision. yuja added a comment. This revision now requires changes to proceed. > The item value can be integer or can be bytes, so cannot use "%d" here. Sounds like a bug. IIUC, the item should be a byte string because it is passed to `ui.progress(item=)`. Can you take a look? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2259 To: pulkit, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 3] revert: account for computed changes in interactive revert (issue5789)
Yuya Nishihara a écrit : > On Wed, 14 Feb 2018 13:41:18 +0100, Denis Laxalde wrote: >> Yuya Nishihara a écrit : >>> On Tue, 13 Feb 2018 21:46:54 +0100, Denis Laxalde wrote: # HG changeset patch # User Denis Laxalde# Date 1518554564 -3600 # Tue Feb 13 21:42:44 2018 +0100 # Node ID a7d28fab177642e028e37b77727603601c3a76cb # Parent 4b8c889eb9d0b7ca6883b93dbd476323c94f677f # EXP-Topic revert-interactive-pats revert: account for computed changes in interactive revert (issue5789) When going through _performrevert() in the interactive case, we build a matcher with files to revert and pass it patch.diff() for later selection of diff hunks to revert. The files set used to build the matcher comes from dirstate and accounts for patterns explicitly passed to revert ('hg revert -i ') and, in case of nonexistent pattern, this set is empty (which is expected). Unfortunately, when going through patch.diff() with the resulting matcher (for which .always() is True), a new changes tuple will be built that completely ignores patterns passed by the user. This leads to the situation described in issue5789, where one gets prompted about reverting files unrelated to specified patterns because they made a typo or so. We fix this by building a 'changes' tuple (scmutil.status tuple) from information computed during dirstate inspection in cmdutil.revert() and pass this to _performrevert() which then hands it to patch.diff(), thus avoiding re-computation of a 'changes' tuple when 'match.always is True'. >>> >>> Perhaps we should instead build an exact matcher from a list of canonical >>> paths: >>> >>> torevert = actions['revert'][0] # XXX needs to drop excluded_files >>> m = scmutil.matchfiles(repo, torevert) >>> >> >> I actually tried that in the first place: >> >> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py >> --- a/mercurial/cmdutil.py >> +++ b/mercurial/cmdutil.py >> @@ -2958,8 +2958,9 @@ def _performrevert(repo, parents, ctx, a >> newlyaddedandmodifiedfiles = set() >> if interactive: >> # Prompt the user for changes to revert >> -torevert = [repo.wjoin(f) for f in actions['revert'][0]] >> -m = scmutil.match(ctx, torevert, matcher_opts) >> +torevert = [repo.wjoin(f) for f in actions['revert'][0] >> +if repo.wjoin(f) not in excluded_files] >> +m = scmutil.matchfiles(repo, torevert) >> diffopts = patch.difffeatureopts(repo.ui, whitespace=True) >> diffopts.nodates = True >> diffopts.git = True >> >> >> but this makes many tests fail (in test-revert-interactive.t) and I did >> not understand why. > > matchfiles() requires canonical paths (i.e. slash-separated paths relative > to repo.root), not filesystem paths. We'll need to drop wjoin(). > Ah, I didn't know that. Seems to work so sending a v2 soon. Thanks! ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2] progress: use '%*d' to pad progress value
# HG changeset patch # User Yuya Nishihara# Date 1518611775 -32400 # Wed Feb 14 21:36:15 2018 +0900 # Node ID d05d2aa5b8682da65928f0e2fe4a8ece0ed42490 # Parent bc9daf3da6a6e53331997ea2145a85fd85417e77 progress: use '%*d' to pad progress value Follows up 7f5108e58083. The problem of '% Nd' is that ' ' means we want {' ' or '-'} as a sign character. We should instead write '%Nd' to pad up to N characters with space, and N can be '*'. diff --git a/mercurial/progress.py b/mercurial/progress.py --- a/mercurial/progress.py +++ b/mercurial/progress.py @@ -119,12 +119,7 @@ class progbar(object): add = topic elif indicator == 'number': if total: -padamount = '%d' % len(str(total)) -# '% 1d' % 1 adds an extra space compared to '% 1s' % 1. -# To avoid this change in output, we convert to a string -# first, then do the padding. -spos = '%d' % pos -add = ('% '+ padamount + 's/%d') % (spos, total) +add = b'%*d/%d' % (len(str(total)), pos, total) else: add = str(pos) elif indicator.startswith('item') and item: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2] py3: stringify IOError/OSError without loosing local character
# HG changeset patch # User Yuya Nishihara# Date 1518611367 -32400 # Wed Feb 14 21:29:27 2018 +0900 # Node ID bc9daf3da6a6e53331997ea2145a85fd85417e77 # Parent be50b344a4b74614c8979ec3b327183c0336b7b1 py3: stringify IOError/OSError without loosing local character Follows up fa4d333cac58. An environment error may contain non-ascii characters on Windows, which should be encoded to a platform-native string. diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -377,7 +377,7 @@ class revbranchcache(object): self._rbcrevs[:] = data except (IOError, OSError) as inst: repo.ui.debug("couldn't read revision branch cache: %s\n" % - pycompat.bytestr(inst)) + util.forcebytestr(inst)) # remember number of good records on disk self._rbcrevslen = min(len(self._rbcrevs) // _rbcrecsize, len(repo.changelog)) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 3] revert: account for computed changes in interactive revert (issue5789)
On Wed, 14 Feb 2018 13:41:18 +0100, Denis Laxalde wrote: > Yuya Nishihara a écrit : > > On Tue, 13 Feb 2018 21:46:54 +0100, Denis Laxalde wrote: > >> # HG changeset patch > >> # User Denis Laxalde> >> # Date 1518554564 -3600 > >> # Tue Feb 13 21:42:44 2018 +0100 > >> # Node ID a7d28fab177642e028e37b77727603601c3a76cb > >> # Parent 4b8c889eb9d0b7ca6883b93dbd476323c94f677f > >> # EXP-Topic revert-interactive-pats > >> revert: account for computed changes in interactive revert (issue5789) > >> > >> When going through _performrevert() in the interactive case, we build a > >> matcher with files to revert and pass it patch.diff() for later > >> selection of diff hunks to revert. The files set used to build the > >> matcher comes from dirstate and accounts for patterns explicitly passed > >> to revert ('hg revert -i ') and, in case of nonexistent pattern, > >> this set is empty (which is expected). Unfortunately, when going through > >> patch.diff() with the resulting matcher (for which .always() is True), a > >> new changes tuple will be built that completely ignores patterns passed > >> by the user. This leads to the situation described in issue5789, where > >> one gets prompted about reverting files unrelated to specified patterns > >> because they made a typo or so. > >> > >> We fix this by building a 'changes' tuple (scmutil.status tuple) from > >> information computed during dirstate inspection in cmdutil.revert() and > >> pass this to _performrevert() which then hands it to patch.diff(), thus > >> avoiding re-computation of a 'changes' tuple when 'match.always is True'. > > > > Perhaps we should instead build an exact matcher from a list of canonical > > paths: > > > > torevert = actions['revert'][0] # XXX needs to drop excluded_files > > m = scmutil.matchfiles(repo, torevert) > > > > I actually tried that in the first place: > > diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py > --- a/mercurial/cmdutil.py > +++ b/mercurial/cmdutil.py > @@ -2958,8 +2958,9 @@ def _performrevert(repo, parents, ctx, a > newlyaddedandmodifiedfiles = set() > if interactive: > # Prompt the user for changes to revert > -torevert = [repo.wjoin(f) for f in actions['revert'][0]] > -m = scmutil.match(ctx, torevert, matcher_opts) > +torevert = [repo.wjoin(f) for f in actions['revert'][0] > +if repo.wjoin(f) not in excluded_files] > +m = scmutil.matchfiles(repo, torevert) > diffopts = patch.difffeatureopts(repo.ui, whitespace=True) > diffopts.nodates = True > diffopts.git = True > > > but this makes many tests fail (in test-revert-interactive.t) and I did > not understand why. matchfiles() requires canonical paths (i.e. slash-separated paths relative to repo.root), not filesystem paths. We'll need to drop wjoin(). ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 3] revert: account for computed changes in interactive revert (issue5789)
Yuya Nishihara a écrit : > On Tue, 13 Feb 2018 21:46:54 +0100, Denis Laxalde wrote: >> # HG changeset patch >> # User Denis Laxalde>> # Date 1518554564 -3600 >> # Tue Feb 13 21:42:44 2018 +0100 >> # Node ID a7d28fab177642e028e37b77727603601c3a76cb >> # Parent 4b8c889eb9d0b7ca6883b93dbd476323c94f677f >> # EXP-Topic revert-interactive-pats >> revert: account for computed changes in interactive revert (issue5789) >> >> When going through _performrevert() in the interactive case, we build a >> matcher with files to revert and pass it patch.diff() for later >> selection of diff hunks to revert. The files set used to build the >> matcher comes from dirstate and accounts for patterns explicitly passed >> to revert ('hg revert -i ') and, in case of nonexistent pattern, >> this set is empty (which is expected). Unfortunately, when going through >> patch.diff() with the resulting matcher (for which .always() is True), a >> new changes tuple will be built that completely ignores patterns passed >> by the user. This leads to the situation described in issue5789, where >> one gets prompted about reverting files unrelated to specified patterns >> because they made a typo or so. >> >> We fix this by building a 'changes' tuple (scmutil.status tuple) from >> information computed during dirstate inspection in cmdutil.revert() and >> pass this to _performrevert() which then hands it to patch.diff(), thus >> avoiding re-computation of a 'changes' tuple when 'match.always is True'. > > Perhaps we should instead build an exact matcher from a list of canonical > paths: > > torevert = actions['revert'][0] # XXX needs to drop excluded_files > m = scmutil.matchfiles(repo, torevert) > I actually tried that in the first place: diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2958,8 +2958,9 @@ def _performrevert(repo, parents, ctx, a newlyaddedandmodifiedfiles = set() if interactive: # Prompt the user for changes to revert -torevert = [repo.wjoin(f) for f in actions['revert'][0]] -m = scmutil.match(ctx, torevert, matcher_opts) +torevert = [repo.wjoin(f) for f in actions['revert'][0] +if repo.wjoin(f) not in excluded_files] +m = scmutil.matchfiles(repo, torevert) diffopts = patch.difffeatureopts(repo.ui, whitespace=True) diffopts.nodates = True diffopts.git = True but this makes many tests fail (in test-revert-interactive.t) and I did not understand why. Still, building the exact matcher *and* passing "changes" to patch.diff() works and seems cleaner. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2271: py3: slice over bytes to prevent getting ascii values
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2271 AFFECTED FILES mercurial/patch.py CHANGE DETAILS diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1450,7 +1450,7 @@ dec = [] line = getline(lr, self.hunk) while len(line) > 1: -l = line[0] +l = line[0:1] if l <= 'Z' and l >= 'A': l = ord(l) - ord('A') + 1 else: To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2269: py3: use pycompat.bytestr instead of str for converting errors to bytes
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2269 AFFECTED FILES hgext/transplant.py mercurial/patch.py CHANGE DETAILS diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1459,7 +1459,7 @@ dec.append(util.b85decode(line[1:])[:l]) except ValueError as e: raise PatchError(_('could not decode "%s" binary patch: %s') - % (self._fname, str(e))) + % (self._fname, pycompat.bytestr(e))) line = getline(lr, self.hunk) text = zlib.decompress(''.join(dec)) if len(text) != size: diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -311,7 +311,7 @@ p1 = repo.dirstate.p1() p2 = node self.log(user, date, message, p1, p2, merge=merge) -self.ui.write(str(inst) + '\n') +self.ui.write(pycompat.bytestr(inst) + '\n') raise TransplantError(_('fix up the working directory and run ' 'hg transplant --continue')) else: To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2270: py3: converts bytes to pycompat.bytestr to get bytechrs while enumerating
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2270 AFFECTED FILES mercurial/pure/base85.py CHANGE DETAILS diff --git a/mercurial/pure/base85.py b/mercurial/pure/base85.py --- a/mercurial/pure/base85.py +++ b/mercurial/pure/base85.py @@ -53,6 +53,7 @@ out = [] for i in range(0, len(text), 5): chunk = text[i:i + 5] +chunk = pycompat.bytestr(chunk) acc = 0 for j, c in enumerate(chunk): try: To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2267: py3: replace file() with open() in transplant.py
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2267 AFFECTED FILES hgext/transplant.py CHANGE DETAILS diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -274,7 +274,7 @@ }, onerr=error.Abort, errprefix=_('filter failed'), blockedtag='transplant_filter') -user, date, msg = self.parselog(file(headerfile))[1:4] +user, date, msg = self.parselog(open(headerfile, 'rb'))[1:4] finally: os.unlink(headerfile) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2268: py3: use pycompat.{bytes|str}kwargs in transplant.py
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2268 AFFECTED FILES hgext/transplant.py CHANGE DETAILS diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -120,7 +120,8 @@ opener=self.opener) def getcommiteditor(): editform = cmdutil.mergeeditform(repo[None], 'transplant') -return cmdutil.getcommiteditor(editform=editform, **opts) +return cmdutil.getcommiteditor(editform=editform, + **pycompat.strkwargs(opts)) self.getcommiteditor = getcommiteditor def applied(self, repo, node, parent): @@ -647,6 +648,7 @@ raise error.Abort(_('--all is incompatible with a ' 'revision list')) +opts = pycompat.byteskwargs(opts) checkopts(opts, revs) if not opts.get('log'): To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2264: py3: use pycompat.bytestr instead of str
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2264 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -337,8 +337,8 @@ ('number', ' ', lambda x: x.fctx.rev(), formatrev), ('changeset', ' ', lambda x: hexfn(x.fctx.node()), formathex), ('date', ' ', lambda x: x.fctx.date(), util.cachefunc(datefunc)), - ('file', ' ', lambda x: x.fctx.path(), str), - ('line_number', ':', lambda x: x.lineno, str), + ('file', ' ', lambda x: x.fctx.path(), pycompat.bytestr), + ('line_number', ':', lambda x: x.lineno, pycompat.bytestr), ] fieldnamemap = {'number': 'rev', 'changeset': 'node'} To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2266: py3: use "%d" for converting int to bytes in transplant.py
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2266 AFFECTED FILES hgext/transplant.py CHANGE DETAILS diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -161,7 +161,7 @@ tr = repo.transaction('transplant') for rev in revs: node = revmap[rev] -revstr = '%s:%s' % (rev, nodemod.short(node)) +revstr = '%d:%s' % (rev, nodemod.short(node)) if self.applied(repo, node, p1): self.ui.warn(_('skipping already applied revision %s\n') % @@ -195,7 +195,7 @@ skipmerge = False if parents[1] != revlog.nullid: if not opts.get('parent'): -self.ui.note(_('skipping merge changeset %s:%s\n') +self.ui.note(_('skipping merge changeset %d:%s\n') % (rev, nodemod.short(node))) skipmerge = True else: To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2263: py3: use "%d" to convert integers to bytes
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2263 AFFECTED FILES hgext/rebase.py hgext/shelve.py mercurial/verify.py CHANGE DETAILS diff --git a/mercurial/verify.py b/mercurial/verify.py --- a/mercurial/verify.py +++ b/mercurial/verify.py @@ -60,6 +60,7 @@ def err(self, linkrev, msg, filename=None): if linkrev is not None: self.badrevs.add(linkrev) +linkrev = "%d" % linkrev else: linkrev = '?' msg = "%s: %s" % (linkrev, msg) diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -271,7 +271,7 @@ "activebook": activebook or cls._noactivebook } scmutil.simplekeyvaluefile(repo.vfs, cls._filename)\ - .write(info, firstline=str(cls._version)) + .write(info, firstline=("%d" % cls._version)) @classmethod def clear(cls, repo): diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -541,7 +541,7 @@ 'to commit\n') % (rev, ctx)) self.skipped.add(rev) self.state[rev] = p1 -ui.debug('next revision set to %s\n' % p1) +ui.debug('next revision set to %d\n' % p1) else: ui.status(_('already rebased %s as %s\n') % (desc, repo[self.state[rev]])) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2265: py3: open files in bytes mode in transplant.py
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2265 AFFECTED FILES hgext/transplant.py CHANGE DETAILS diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -211,7 +211,7 @@ patchfile = None else: fd, patchfile = tempfile.mkstemp(prefix='hg-transplant-') -fp = os.fdopen(fd, pycompat.sysstr('w')) +fp = os.fdopen(fd, pycompat.sysstr('wb')) gen = patch.diff(source, parent, node, opts=diffopts) for chunk in gen: fp.write(chunk) @@ -259,7 +259,7 @@ self.ui.status(_('filtering %s\n') % patchfile) user, date, msg = (changelog[1], changelog[2], changelog[4]) fd, headerfile = tempfile.mkstemp(prefix='hg-transplant-') -fp = os.fdopen(fd, pycompat.sysstr('w')) +fp = os.fdopen(fd, pycompat.sysstr('wb')) fp.write("# HG changeset patch\n") fp.write("# User %s\n" % user) fp.write("# Date %d %d\n" % date) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2255: releasenotes: replace abort with warning while parsing
rishabhmadan96 added a comment. Yeah, my bad. I'll send an updated version with the suggested changes. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2255 To: rishabhmadan96, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2226: progress: use %d to format ints instead of %s
yuja added a comment. Maybe we want `'%d'`, not `'% d'`? The latter means to use `' '` in place of `'+'` sign. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2226 To: durin42, #hg-reviewers, indygreg Cc: yuja, indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 3] revert: account for computed changes in interactive revert (issue5789)
On Tue, 13 Feb 2018 21:46:54 +0100, Denis Laxalde wrote: > # HG changeset patch > # User Denis Laxalde> # Date 1518554564 -3600 > # Tue Feb 13 21:42:44 2018 +0100 > # Node ID a7d28fab177642e028e37b77727603601c3a76cb > # Parent 4b8c889eb9d0b7ca6883b93dbd476323c94f677f > # EXP-Topic revert-interactive-pats > revert: account for computed changes in interactive revert (issue5789) > > When going through _performrevert() in the interactive case, we build a > matcher with files to revert and pass it patch.diff() for later > selection of diff hunks to revert. The files set used to build the > matcher comes from dirstate and accounts for patterns explicitly passed > to revert ('hg revert -i ') and, in case of nonexistent pattern, > this set is empty (which is expected). Unfortunately, when going through > patch.diff() with the resulting matcher (for which .always() is True), a > new changes tuple will be built that completely ignores patterns passed > by the user. This leads to the situation described in issue5789, where > one gets prompted about reverting files unrelated to specified patterns > because they made a typo or so. > > We fix this by building a 'changes' tuple (scmutil.status tuple) from > information computed during dirstate inspection in cmdutil.revert() and > pass this to _performrevert() which then hands it to patch.diff(), thus > avoiding re-computation of a 'changes' tuple when 'match.always is True'. Perhaps we should instead build an exact matcher from a list of canonical paths: torevert = actions['revert'][0] # XXX needs to drop excluded_files m = scmutil.matchfiles(repo, torevert) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH V2] dirstate: drop explicit files that shouldn't match (BC) (issue4679)
# HG changeset patch # User Yuya Nishihara# Date 1516963719 -32400 # Fri Jan 26 19:48:39 2018 +0900 # Node ID be50b344a4b74614c8979ec3b327183c0336b7b1 # Parent 7e6aad95244f5e4a66a40efc657012eb9ec5185b dirstate: drop explicit files that shouldn't match (BC) (issue4679) Before, wctx.walk() could include files excluded by -X pattern, which disagrees with wctx.matches() and ctx.walk()/matches() behavior. This patch fixes the problem by testing stat results against the matcher if the matcher may contain false paths. I have no idea if the fix should be made before the workaround for case- insensitive filesystems, but that shouldn't matter since match.anypats() means 'not match.isexact()'. This patch also makes narrow and sparse extensions to not exclude explicit paths on walk() because they appear to depend on the buggy behavior. More detailed analysis about this issue by Martin von Zweigbergk: "I think it's just an unintended consequence of how the dirstate walk works, but I'm not sure. The exception for explicit files also bothered me when I was working on the matcher code a year or so ago. I actually added the exception to the matcher code because I thought it was always working like that (not just for dirstate) in a83a7d27911e (match: handle excludes using new differencematcher, 2017-05-16). It was only recently that Yuya realized that it used to be inconsistent and that I probably made it consistently bad because I didn't realize it was inconsistent to start with, see 821d8a5ab4ff (match: do not weirdly include explicit files excluded by -X option, 2018-01-16)." .. bc:: Working-directory commands now respect ``-X PATTERN`` no matter if PATTERN matches explicitly-specified FILEs. For example, ``hg add foo -X foo`` no longer add the file ``foo``. diff --git a/hgext/narrow/narrowdirstate.py b/hgext/narrow/narrowdirstate.py --- a/hgext/narrow/narrowdirstate.py +++ b/hgext/narrow/narrowdirstate.py @@ -23,8 +23,11 @@ def setup(repo): def walk(orig, self, match, subrepos, unknown, ignored, full=True, narrowonly=True): if narrowonly: -narrowmatch = repo.narrowmatch() -match = matchmod.intersectmatchers(match, narrowmatch) +# hack to not exclude explicitly-specified paths so that they can +# be warned later on e.g. dirstate.add() +em = matchmod.exact(match._root, match._cwd, match.files()) +nm = matchmod.unionmatcher([repo.narrowmatch(), em]) +match = matchmod.intersectmatchers(match, nm) return orig(self, match, subrepos, unknown, ignored, full) extensions.wrapfunction(dirstate.dirstate, 'walk', walk) diff --git a/hgext/sparse.py b/hgext/sparse.py --- a/hgext/sparse.py +++ b/hgext/sparse.py @@ -194,7 +194,11 @@ def _setupdirstate(ui): """ def walk(orig, self, match, subrepos, unknown, ignored, full=True): -match = matchmod.intersectmatchers(match, self._sparsematcher) +# hack to not exclude explicitly-specified paths so that they can +# be warned later on e.g. dirstate.add() +em = matchmod.exact(match._root, match._cwd, match.files()) +sm = matchmod.unionmatcher([self._sparsematcher, em]) +match = matchmod.intersectmatchers(match, sm) return orig(self, match, subrepos, unknown, ignored, full) extensions.wrapfunction(dirstate.dirstate, 'walk', walk) diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -787,6 +787,17 @@ class dirstate(object): else: badfn(ff, encoding.strtolocal(inst.strerror)) +# match.files() may contain explicitly-specified paths that shouldn't +# be taken; drop them from the list of files found. dirsfound/notfound +# aren't filtered here because they will be tested later. +if match.anypats(): +for f in list(results): +if f == '.hg' or f in subrepos: +# keep sentinel to disable further out-of-repo walks +continue +if not match(f): +del results[f] + # Case insensitive filesystems cannot rely on lstat() failing to detect # a case-only rename. Prune the stat object for any file that does not # match the case in the filesystem, if there are multiple files that diff --git a/tests/test-add.t b/tests/test-add.t --- a/tests/test-add.t +++ b/tests/test-add.t @@ -146,6 +146,13 @@ Issue683: peculiarity with hg revert of M a ? a.orig +excluded file shouldn't be added even if it is explicitly specified + + $ hg add a.orig -X '*.orig' + $ hg st + M a + ? a.orig + Forgotten file can be added back (as either clean or modified) $ hg forget b diff --git a/tests/test-narrow-commit.t b/tests/test-narrow-commit.t --- a/tests/test-narrow-commit.t +++ b/tests/test-narrow-commit.t @@ -55,6
D2245: ui: coerce system exception to bytes before dropping it in our StdioError
yuja added a comment. This breaks test-basic.t and is wrong because StdioError is an IOError, which takes a system string. @@ -36,10 +36,10 @@ #if devfull $ hg status >/dev/full 2>&1 - [255] + [1] $ hg status ENOENT 2>/dev/full - [255] + [1] #endif I'll drop this from hg-committed. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2245 To: durin42, #hg-reviewers, indygreg Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2260: py3: add b'' to make sure regex pattern are bytes in hgweb/webutil.py
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame because we are just adding b'' prefixes REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2260 AFFECTED FILES mercurial/hgweb/webutil.py CHANGE DETAILS diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -626,15 +626,15 @@ # delimiters. the replace format and flags are optional, but # delimiters are required. match = re.match( -r'^s%s(.+)(?:(?<=)|(?https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2262: py3: add couple of missing b'' in fakemergerecord.py
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame as we are just adding b'' prefixes REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2262 AFFECTED FILES tests/fakemergerecord.py CHANGE DETAILS diff --git a/tests/fakemergerecord.py b/tests/fakemergerecord.py --- a/tests/fakemergerecord.py +++ b/tests/fakemergerecord.py @@ -19,8 +19,8 @@ with repo.wlock(): ms = merge.mergestate.read(repo) records = ms._makerecords() -if opts.get('mandatory'): +if opts.get(b'mandatory'): records.append((b'X', b'mandatory record')) -if opts.get('advisory'): +if opts.get(b'advisory'): records.append((b'x', b'advisory record')) ms._writerecords(records) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2259: py3: use pycompat.bytestr to convert int/bytes to bytes
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The item value can be integer or can be bytes, so cannot use "%d" here. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2259 AFFECTED FILES mercurial/worker.py CHANGE DETAILS diff --git a/mercurial/worker.py b/mercurial/worker.py --- a/mercurial/worker.py +++ b/mercurial/worker.py @@ -156,7 +156,7 @@ def workerfunc(): os.close(rfd) for i, item in func(*(staticargs + (pargs,))): -os.write(wfd, '%d %s\n' % (i, item)) +os.write(wfd, '%d %s\n' % (i, pycompat.bytestr(item))) return 0 ret = scmutil.callcatch(ui, workerfunc) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2261: py3: use pycompat.bytestr to convert str to bytes
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2261 AFFECTED FILES mercurial/changelog.py mercurial/ui.py CHANGE DETAILS diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -809,7 +809,7 @@ 'to set your username')) if "\n" in user: raise error.Abort(_("username %s contains a newline\n") - % repr(user)) + % pycompat.bytestr(repr(user))) return user def shortuser(self, user): diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -20,6 +20,7 @@ from . import ( encoding, error, +pycompat, revlog, util, ) @@ -518,7 +519,7 @@ raise error.RevlogError(_("empty username")) if "\n" in user: raise error.RevlogError(_("username %s contains a newline") -% repr(user)) +% pycompat.bytestr(repr(user))) desc = stripdesc(desc) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2257: py3: add b'' prefixes to make printrevset.py work in test-glog.t
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame because we are just adding b'' prefixes REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2257 AFFECTED FILES tests/test-glog.t CHANGE DETAILS diff --git a/tests/test-glog.t b/tests/test-glog.t --- a/tests/test-glog.t +++ b/tests/test-glog.t @@ -102,23 +102,23 @@ > def uisetup(ui): > def printrevset(orig, repo, pats, opts): > revs, filematcher = orig(repo, pats, opts) - > if opts.get('print_revset'): + > if opts.get(b'print_revset'): > expr = logrevset(repo, pats, opts) > if expr: > tree = revsetlang.parse(expr) > tree = revsetlang.analyze(tree) > else: > tree = [] > ui = repo.ui - > ui.write('%r\n' % (opts.get('rev', []),)) - > ui.write(revsetlang.prettyformat(tree) + '\n') - > ui.write(smartset.prettyformat(revs) + '\n') + > ui.write(b'%r\n' % (opts.get(b'rev', []),)) + > ui.write(revsetlang.prettyformat(tree) + b'\n') + > ui.write(smartset.prettyformat(revs) + b'\n') > revs = smartset.baseset() # display no revisions > return revs, filematcher > extensions.wrapfunction(logcmdutil, 'getrevs', printrevset) - > aliases, entry = cmdutil.findcmd('log', commands.table) - > entry[1].append(('', 'print-revset', False, - > 'print generated revset and exit (DEPRECATED)')) + > aliases, entry = cmdutil.findcmd(b'log', commands.table) + > entry[1].append((b'', b'print-revset', False, + > b'print generated revset and exit (DEPRECATED)')) > EOF $ echo "[extensions]" >> $HGRCPATH To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2258: py3: add b'' prefixes in test-worker.t
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame because we are just adding b'' REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2258 AFFECTED FILES tests/test-worker.t CHANGE DETAILS diff --git a/tests/test-worker.t b/tests/test-worker.t --- a/tests/test-worker.t +++ b/tests/test-worker.t @@ -12,34 +12,34 @@ > def abort(ui, args): > if args[0] == 0: > # by first worker for test stability - > raise error.Abort('known exception') + > raise error.Abort(b'known exception') > return runme(ui, []) > def exc(ui, args): > if args[0] == 0: > # by first worker for test stability > raise Exception('unknown exception') > return runme(ui, []) > def runme(ui, args): > for arg in args: - > ui.status('run\n') + > ui.status(b'run\n') > yield 1, arg > time.sleep(0.1) # easier to trigger killworkers code path > functable = { - > 'abort': abort, - > 'exc': exc, - > 'runme': runme, + > b'abort': abort, + > b'exc': exc, + > b'runme': runme, > } > cmdtable = {} > command = registrar.command(cmdtable) - > @command(b'test', [], 'hg test [COST] [FUNC]') - > def t(ui, repo, cost=1.0, func='runme'): + > @command(b'test', [], b'hg test [COST] [FUNC]') + > def t(ui, repo, cost=1.0, func=b'runme'): > cost = float(cost) > func = functable[func] - > ui.status('start\n') + > ui.status(b'start\n') > runs = worker.worker(ui, cost, func, (ui,), range(8)) > for n, i in runs: > pass - > ui.status('done\n') + > ui.status(b'done\n') > EOF $ abspath=`pwd`/t.py $ hg init To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2256: py3: slice over bytes to prevent getting ascii values
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2256 AFFECTED FILES mercurial/graphmod.py mercurial/hgweb/webutil.py CHANGE DETAILS diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -619,7 +619,7 @@ websubdefs += repo.ui.configitems('interhg') for key, pattern in websubdefs: # grab the delimiter from the character after the "s" -unesc = pattern[1] +unesc = pattern[1:2] delim = re.escape(unesc) # identify portions of the pattern, taking care to avoid escaped diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py --- a/mercurial/graphmod.py +++ b/mercurial/graphmod.py @@ -454,16 +454,16 @@ if any(len(char) > 1 for char in edgemap.values()): # limit drawing an edge to the first or last N lines of the current # section the rest of the edge is drawn like a parent line. -parent = state['styles'][PARENT][-1] +parent = state['styles'][PARENT][-1:] def _drawgp(char, i): # should a grandparent character be drawn for this line? if len(char) < 2: return True num = int(char[:-1]) # either skip first num lines or take last num lines, based on sign return -num <= i if num < 0 else (len(lines) - i) <= num for i, line in enumerate(lines): -line[:] = [c[-1] if _drawgp(c, i) else parent for c in line] +line[:] = [c[-1:] if _drawgp(c, i) else parent for c in line] edgemap.update( (e, (c if len(c) < 2 else parent)) for e, c in edgemap.items()) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1758: remotenames: add new namespaces for remotebookmarks and remotebranches
pulkit added inline comments. INLINE COMMENTS > martinvonz wrote in test-logexchange.t:130-131 > This is pretty hard to read. Should we at least add a space between the > label-and-colon and the value? I agree with you. I will send a followup for this. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1758 To: pulkit, #hg-reviewers, durin42 Cc: martinvonz, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2253: releasenotes: mention changeset with warning and abort
pulkit added inline comments. INLINE COMMENTS > av6 wrote in releasenotes.py:315 > or `ctx.hex()` That's also okay. `str(ctx) = ctx.hex()[:12]` REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2253 To: rishabhmadan96, #hg-reviewers Cc: av6, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2255: releasenotes: replace abort with warning while parsing
pulkit added a comment. This one is a bugfix, so please add the issue number in the commit message. Also add related tests as that will help make sure we don't encounter such problems again in future. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2255 To: rishabhmadan96, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2253: releasenotes: mention changeset with warning and abort
av6 added inline comments. INLINE COMMENTS > pulkit wrote in releasenotes.py:315 > No need for `node.hex(ctx.node())`, just use ctx. or `ctx.hex()` REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2253 To: rishabhmadan96, #hg-reviewers Cc: av6, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2254: releasenotes: allow notes for multiple directives in a single changeset
pulkit added a comment. Can you add tests showing what the new behavior is? The correct behavior should be to include multiple directives in the notes correctly. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2254 To: rishabhmadan96, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel