Show More
@@ -909,6 +909,19 b' static inline void set_phase_from_parent' | |||||
909 | phases[i] = phases[parent_2]; |
|
909 | phases[i] = phases[parent_2]; | |
910 | } |
|
910 | } | |
911 |
|
911 | |||
|
912 | /* Take ownership of a given Python value and add it to a Python list. | |||
|
913 | Return -1 on failure (including if [elem] is NULL). */ | |||
|
914 | static int pylist_append_owned(PyObject *list, PyObject *elem) | |||
|
915 | { | |||
|
916 | int res; | |||
|
917 | ||||
|
918 | if (elem == NULL) | |||
|
919 | return -1; | |||
|
920 | res = PyList_Append(list, elem); | |||
|
921 | Py_DECREF(elem); | |||
|
922 | return res; | |||
|
923 | } | |||
|
924 | ||||
912 | static PyObject *reachableroots2(indexObject *self, PyObject *args) |
|
925 | static PyObject *reachableroots2(indexObject *self, PyObject *args) | |
913 | { |
|
926 | { | |
914 |
|
927 | |||
@@ -921,7 +934,6 b' static PyObject *reachableroots2(indexOb' | |||||
921 | PyObject *roots = NULL; |
|
934 | PyObject *roots = NULL; | |
922 | PyObject *reachable = NULL; |
|
935 | PyObject *reachable = NULL; | |
923 |
|
936 | |||
924 | PyObject *val; |
|
|||
925 | Py_ssize_t len = index_length(self); |
|
937 | Py_ssize_t len = index_length(self); | |
926 | long revnum; |
|
938 | long revnum; | |
927 | Py_ssize_t k; |
|
939 | Py_ssize_t k; | |
@@ -1002,11 +1014,8 b' static PyObject *reachableroots2(indexOb' | |||||
1002 | revnum = tovisit[k++]; |
|
1014 | revnum = tovisit[k++]; | |
1003 | if (revstates[revnum + 1] & RS_ROOT) { |
|
1015 | if (revstates[revnum + 1] & RS_ROOT) { | |
1004 | revstates[revnum + 1] |= RS_REACHABLE; |
|
1016 | revstates[revnum + 1] |= RS_REACHABLE; | |
1005 | val = PyLong_FromLong(revnum); |
|
1017 | r = pylist_append_owned(reachable, | |
1006 | if (val == NULL) |
|
1018 | PyLong_FromLong(revnum)); | |
1007 | goto bail; |
|
|||
1008 | r = PyList_Append(reachable, val); |
|
|||
1009 | Py_DECREF(val); |
|
|||
1010 | if (r < 0) |
|
1019 | if (r < 0) | |
1011 | goto bail; |
|
1020 | goto bail; | |
1012 | if (includepath == 0) |
|
1021 | if (includepath == 0) | |
@@ -1047,11 +1056,8 b' static PyObject *reachableroots2(indexOb' | |||||
1047 | RS_REACHABLE) && |
|
1056 | RS_REACHABLE) && | |
1048 | !(revstates[i + 1] & RS_REACHABLE)) { |
|
1057 | !(revstates[i + 1] & RS_REACHABLE)) { | |
1049 | revstates[i + 1] |= RS_REACHABLE; |
|
1058 | revstates[i + 1] |= RS_REACHABLE; | |
1050 | val = PyLong_FromSsize_t(i); |
|
1059 | r = pylist_append_owned(reachable, | |
1051 | if (val == NULL) |
|
1060 | PyLong_FromSsize_t(i)); | |
1052 | goto bail; |
|
|||
1053 | r = PyList_Append(reachable, val); |
|
|||
1054 | Py_DECREF(val); |
|
|||
1055 | if (r < 0) |
|
1061 | if (r < 0) | |
1056 | goto bail; |
|
1062 | goto bail; | |
1057 | } |
|
1063 | } | |
@@ -1263,8 +1269,7 b' static PyObject *index_headrevs(indexObj' | |||||
1263 | if (heads == NULL) |
|
1269 | if (heads == NULL) | |
1264 | goto bail; |
|
1270 | goto bail; | |
1265 | if (len == 0) { |
|
1271 | if (len == 0) { | |
1266 | PyObject *nullid = PyLong_FromLong(-1); |
|
1272 | if (pylist_append_owned(heads, PyLong_FromLong(-1)) == -1) { | |
1267 | if (nullid == NULL || PyList_Append(heads, nullid) == -1) { |
|
|||
1268 | Py_XDECREF(nullid); |
|
1273 | Py_XDECREF(nullid); | |
1269 | goto bail; |
|
1274 | goto bail; | |
1270 | } |
|
1275 | } | |
@@ -1308,13 +1313,9 b' static PyObject *index_headrevs(indexObj' | |||||
1308 | } |
|
1313 | } | |
1309 |
|
1314 | |||
1310 | for (i = 0; i < len; i++) { |
|
1315 | for (i = 0; i < len; i++) { | |
1311 | PyObject *head; |
|
|||
1312 |
|
||||
1313 | if (nothead[i]) |
|
1316 | if (nothead[i]) | |
1314 | continue; |
|
1317 | continue; | |
1315 | head = PyLong_FromSsize_t(i); |
|
1318 | if (pylist_append_owned(heads, PyLong_FromSsize_t(i)) == -1) { | |
1316 | if (head == NULL || PyList_Append(heads, head) == -1) { |
|
|||
1317 | Py_XDECREF(head); |
|
|||
1318 | goto bail; |
|
1319 | goto bail; | |
1319 | } |
|
1320 | } | |
1320 | } |
|
1321 | } | |
@@ -1561,15 +1562,9 b' static PyObject *index_deltachain(indexO' | |||||
1561 | iterrev = rev; |
|
1562 | iterrev = rev; | |
1562 |
|
1563 | |||
1563 | while (iterrev != baserev && iterrev != stoprev) { |
|
1564 | while (iterrev != baserev && iterrev != stoprev) { | |
1564 | PyObject *value = PyLong_FromLong(iterrev); |
|
1565 | if (pylist_append_owned(chain, PyLong_FromLong(iterrev))) { | |
1565 | if (value == NULL) { |
|
|||
1566 | goto bail; |
|
1566 | goto bail; | |
1567 | } |
|
1567 | } | |
1568 | if (PyList_Append(chain, value)) { |
|
|||
1569 | Py_DECREF(value); |
|
|||
1570 | goto bail; |
|
|||
1571 | } |
|
|||
1572 | Py_DECREF(value); |
|
|||
1573 |
|
1568 | |||
1574 | if (generaldelta) { |
|
1569 | if (generaldelta) { | |
1575 | iterrev = baserev; |
|
1570 | iterrev = baserev; | |
@@ -1600,15 +1595,9 b' static PyObject *index_deltachain(indexO' | |||||
1600 | if (iterrev == stoprev) { |
|
1595 | if (iterrev == stoprev) { | |
1601 | stopped = 1; |
|
1596 | stopped = 1; | |
1602 | } else { |
|
1597 | } else { | |
1603 | PyObject *value = PyLong_FromLong(iterrev); |
|
1598 | if (pylist_append_owned(chain, PyLong_FromLong(iterrev))) { | |
1604 | if (value == NULL) { |
|
|||
1605 | goto bail; |
|
1599 | goto bail; | |
1606 | } |
|
1600 | } | |
1607 | if (PyList_Append(chain, value)) { |
|
|||
1608 | Py_DECREF(value); |
|
|||
1609 | goto bail; |
|
|||
1610 | } |
|
|||
1611 | Py_DECREF(value); |
|
|||
1612 |
|
1601 | |||
1613 | stopped = 0; |
|
1602 | stopped = 0; | |
1614 | } |
|
1603 | } | |
@@ -1727,7 +1716,6 b' static PyObject *index_slicechunktodensi' | |||||
1727 | 0; /* total number of notable gap recorded so far */ |
|
1716 | 0; /* total number of notable gap recorded so far */ | |
1728 | Py_ssize_t *selected_indices = NULL; /* indices of gap skipped over */ |
|
1717 | Py_ssize_t *selected_indices = NULL; /* indices of gap skipped over */ | |
1729 | Py_ssize_t num_selected = 0; /* number of gaps skipped */ |
|
1718 | Py_ssize_t num_selected = 0; /* number of gaps skipped */ | |
1730 | PyObject *chunk = NULL; /* individual slice */ |
|
|||
1731 | PyObject *allchunks = NULL; /* all slices */ |
|
1719 | PyObject *allchunks = NULL; /* all slices */ | |
1732 | Py_ssize_t previdx; |
|
1720 | Py_ssize_t previdx; | |
1733 |
|
1721 | |||
@@ -1872,15 +1860,11 b' static PyObject *index_slicechunktodensi' | |||||
1872 | goto bail; |
|
1860 | goto bail; | |
1873 | } |
|
1861 | } | |
1874 | if (previdx < endidx) { |
|
1862 | if (previdx < endidx) { | |
1875 | chunk = PyList_GetSlice(list_revs, previdx, endidx); |
|
1863 | PyObject *chunk = | |
1876 | if (chunk == NULL) { |
|
1864 | PyList_GetSlice(list_revs, previdx, endidx); | |
|
1865 | if (pylist_append_owned(allchunks, chunk) == -1) { | |||
1877 | goto bail; |
|
1866 | goto bail; | |
1878 | } |
|
1867 | } | |
1879 | if (PyList_Append(allchunks, chunk) == -1) { |
|
|||
1880 | goto bail; |
|
|||
1881 | } |
|
|||
1882 | Py_DECREF(chunk); |
|
|||
1883 | chunk = NULL; |
|
|||
1884 | } |
|
1868 | } | |
1885 | previdx = idx; |
|
1869 | previdx = idx; | |
1886 | } |
|
1870 | } | |
@@ -1889,7 +1873,6 b' static PyObject *index_slicechunktodensi' | |||||
1889 |
|
1873 | |||
1890 | bail: |
|
1874 | bail: | |
1891 | Py_XDECREF(allchunks); |
|
1875 | Py_XDECREF(allchunks); | |
1892 | Py_XDECREF(chunk); |
|
|||
1893 | done: |
|
1876 | done: | |
1894 | free(revs); |
|
1877 | free(revs); | |
1895 | free(gaps); |
|
1878 | free(gaps); | |
@@ -2534,11 +2517,8 b' static PyObject *find_gca_candidates(ind' | |||||
2534 | if (sv < poison) { |
|
2517 | if (sv < poison) { | |
2535 | interesting -= 1; |
|
2518 | interesting -= 1; | |
2536 | if (sv == allseen) { |
|
2519 | if (sv == allseen) { | |
2537 | PyObject *obj = PyLong_FromLong(v); |
|
2520 | if (pylist_append_owned( | |
2538 | if (obj == NULL) |
|
2521 | gca, PyLong_FromLong(v)) == -1) { | |
2539 | goto bail; |
|
|||
2540 | if (PyList_Append(gca, obj) == -1) { |
|
|||
2541 | Py_DECREF(obj); |
|
|||
2542 | goto bail; |
|
2522 | goto bail; | |
2543 | } |
|
2523 | } | |
2544 | sv |= poison; |
|
2524 | sv |= poison; |
@@ -501,7 +501,7 b' class compressionlevel(formatvariant):' | |||||
501 | level = repo.ui.configint(b'storage', b'revlog.zstd.level') |
|
501 | level = repo.ui.configint(b'storage', b'revlog.zstd.level') | |
502 | if level is None: |
|
502 | if level is None: | |
503 | return b'default' |
|
503 | return b'default' | |
504 |
return b |
|
504 | return b"%d" % level | |
505 |
|
505 | |||
506 | @classmethod |
|
506 | @classmethod | |
507 | def fromconfig(cls, repo): |
|
507 | def fromconfig(cls, repo): | |
@@ -513,7 +513,7 b' class compressionlevel(formatvariant):' | |||||
513 | level = repo.ui.configint(b'storage', b'revlog.zstd.level') |
|
513 | level = repo.ui.configint(b'storage', b'revlog.zstd.level') | |
514 | if level is None: |
|
514 | if level is None: | |
515 | return b'default' |
|
515 | return b'default' | |
516 |
return b |
|
516 | return b"%d" % level | |
517 |
|
517 | |||
518 |
|
518 | |||
519 | def find_format_upgrades(repo): |
|
519 | def find_format_upgrades(repo): |
@@ -561,12 +561,12 b' If CHGHG is not set, chg will set it bef' | |||||
561 | $ hg --kill-chg-daemon |
|
561 | $ hg --kill-chg-daemon | |
562 | $ HG=$CHGHG CHGHG= CHGDEBUG= hg debugshell -c \ |
|
562 | $ HG=$CHGHG CHGHG= CHGDEBUG= hg debugshell -c \ | |
563 | > 'ui.write(b"CHGHG=%s\n" % ui.environ.get(b"CHGHG"))' 2>&1 \ |
|
563 | > 'ui.write(b"CHGHG=%s\n" % ui.environ.get(b"CHGHG"))' 2>&1 \ | |
564 | > | grep -E 'CHGHG|start' |
|
564 | > | grep -E 'CHGHG|start cmdserver' | |
565 | chg: debug: * start cmdserver at * (glob) |
|
565 | chg: debug: * start cmdserver at * (glob) | |
566 | CHGHG=/*/install/bin/hg (glob) |
|
566 | CHGHG=/*/install/bin/hg (glob) | |
567 |
|
567 | |||
568 | Running the same command a second time shouldn't spawn a new command server. |
|
568 | Running the same command a second time shouldn't spawn a new command server. | |
569 | $ HG=$CHGHG CHGHG= CHGDEBUG= hg debugshell -c \ |
|
569 | $ HG=$CHGHG CHGHG= CHGDEBUG= hg debugshell -c \ | |
570 | > 'ui.write(b"CHGHG=%s\n" % ui.environ.get(b"CHGHG"))' 2>&1 \ |
|
570 | > 'ui.write(b"CHGHG=%s\n" % ui.environ.get(b"CHGHG"))' 2>&1 \ | |
571 | > | grep -E 'CHGHG|start' |
|
571 | > | grep -E 'CHGHG|start cmdserver' | |
572 | CHGHG=/*/install/bin/hg (glob) |
|
572 | CHGHG=/*/install/bin/hg (glob) |
General Comments 0
You need to be logged in to leave comments.
Login now