##// END OF EJS Templates
delta-find: use sets instead of list in the snapshot cache...
marmoute -
r50574:b670eb3d default
parent child Browse files
Show More
@@ -1489,7 +1489,7 b' static PyObject *index_findsnapshots(ind'
1489 }
1489 }
1490 if (allvalues == NULL) {
1490 if (allvalues == NULL) {
1491 int r;
1491 int r;
1492 allvalues = PyList_New(0);
1492 allvalues = PySet_New(0);
1493 if (!allvalues) {
1493 if (!allvalues) {
1494 goto bail;
1494 goto bail;
1495 }
1495 }
@@ -1500,7 +1500,7 b' static PyObject *index_findsnapshots(ind'
1500 }
1500 }
1501 }
1501 }
1502 value = PyLong_FromSsize_t(rev);
1502 value = PyLong_FromSsize_t(rev);
1503 if (PyList_Append(allvalues, value)) {
1503 if (PySet_Add(allvalues, value)) {
1504 goto bail;
1504 goto bail;
1505 }
1505 }
1506 Py_CLEAR(key);
1506 Py_CLEAR(key);
@@ -989,8 +989,7 b' class SnapshotCache:'
989 __slots__ = ('snapshots', '_start_rev', '_end_rev')
989 __slots__ = ('snapshots', '_start_rev', '_end_rev')
990
990
991 def __init__(self):
991 def __init__(self):
992 # XXX should probably be a set ?
992 self.snapshots = collections.defaultdict(set)
993 self.snapshots = collections.defaultdict(list)
994 self._start_rev = None
993 self._start_rev = None
995 self._end_rev = None
994 self._end_rev = None
996
995
@@ -1038,7 +1037,7 b' class SnapshotCache:'
1038 issnapshot = revlog.issnapshot
1037 issnapshot = revlog.issnapshot
1039 for rev in revlog.revs(start_rev, end_rev):
1038 for rev in revlog.revs(start_rev, end_rev):
1040 if issnapshot(rev):
1039 if issnapshot(rev):
1041 cache[deltaparent(rev)].append(rev)
1040 cache[deltaparent(rev)].add(rev)
1042
1041
1043
1042
1044 class deltacomputer:
1043 class deltacomputer:
@@ -466,8 +466,8 b' def issnapshottest(rlog):'
466 print(' got: %s' % result)
466 print(' got: %s' % result)
467
467
468
468
469 snapshotmapall = {0: [6, 8, 11, 17, 19, 25], 8: [21], -1: [0, 30]}
469 snapshotmapall = {0: {6, 8, 11, 17, 19, 25}, 8: {21}, -1: {0, 30}}
470 snapshotmap15 = {0: [17, 19, 25], 8: [21], -1: [30]}
470 snapshotmap15 = {0: {17, 19, 25}, 8: {21}, -1: {30}}
471
471
472
472
473 def findsnapshottest(rlog):
473 def findsnapshottest(rlog):
General Comments 0
You need to be logged in to leave comments. Login now