Details
Details
- Reviewers
 pulkit - Group Reviewers
 hg-reviewers - Commits
 - rHG2888d12b80a6: tests: fix up uses of xrange in remotefilelog tests for py3
 
Diff Detail
Diff Detail
- Repository
 - rHG Mercurial
 - Lint
 Lint Skipped - Unit
 Unit Tests Skipped 
| pulkit | 
| hg-reviewers | 
| Lint Skipped | 
| Unit Tests Skipped | 
| Path | Packages | |||
|---|---|---|---|---|
| M | tests/test-remotefilelog-cacheprocess.t (2 lines) | |||
| M | tests/test-remotefilelog-datapack.py (5 lines) | 
| Commit | Parents | Author | Summary | Date | 
|---|---|---|---|---|
| Augie Fackler | Jan 16 2019, 10:59 AM | 
| $ echo z > z | $ echo z > z | ||||
| $ hg commit -qAm xy | $ hg commit -qAm xy | ||||
| $ cd .. | $ cd .. | ||||
| $ cat > cacheprocess-logger.py <<EOF | $ cat > cacheprocess-logger.py <<EOF | ||||
| > import os | > import os | ||||
| > import shutil | > import shutil | ||||
| > import sys | > import sys | ||||
| > if sys.version_info[0] > 2: | |||||
| > xrange = range | |||||
| > f = open('$TESTTMP/cachelog.log', 'w') | > f = open('$TESTTMP/cachelog.log', 'w') | ||||
| > srccache = os.path.join('$TESTTMP', 'oldhgcache') | > srccache = os.path.join('$TESTTMP', 'oldhgcache') | ||||
| > def log(message): | > def log(message): | ||||
| > f.write(message) | > f.write(message) | ||||
| > f.flush() | > f.flush() | ||||
| > destcache = sys.argv[-1] | > destcache = sys.argv[-1] | ||||
| > try: | > try: | ||||
| > while True: | > while True: | ||||
| import unittest | import unittest | ||||
| import silenttestrunner | import silenttestrunner | ||||
| # Load the local remotefilelog, not the system one | # Load the local remotefilelog, not the system one | ||||
| sys.path[0:0] = [os.path.join(os.path.dirname(__file__), '..')] | sys.path[0:0] = [os.path.join(os.path.dirname(__file__), '..')] | ||||
| from mercurial.node import nullid | from mercurial.node import nullid | ||||
| from mercurial import ( | from mercurial import ( | ||||
| pycompat, | |||||
| ui as uimod, | ui as uimod, | ||||
| ) | ) | ||||
| from hgext.remotefilelog import ( | from hgext.remotefilelog import ( | ||||
| basepack, | basepack, | ||||
| constants, | constants, | ||||
| datapack, | datapack, | ||||
| ) | ) | ||||
| self.assertEquals(len(chain), 1) | self.assertEquals(len(chain), 1) | ||||
| def testLargePack(self): | def testLargePack(self): | ||||
| """Test creating and reading from a large pack with over X entries. | """Test creating and reading from a large pack with over X entries. | ||||
| This causes it to use a 2^16 fanout table instead.""" | This causes it to use a 2^16 fanout table instead.""" | ||||
| revisions = [] | revisions = [] | ||||
| blobs = {} | blobs = {} | ||||
| total = basepack.SMALLFANOUTCUTOFF + 1 | total = basepack.SMALLFANOUTCUTOFF + 1 | ||||
| for i in xrange(total): | for i in pycompat.xrange(total): | ||||
| filename = "filename-%s" % i | filename = "filename-%s" % i | ||||
| content = filename | content = filename | ||||
| node = self.getHash(content) | node = self.getHash(content) | ||||
| blobs[(filename, node)] = content | blobs[(filename, node)] = content | ||||
| revisions.append((filename, node, nullid, content)) | revisions.append((filename, node, nullid, content)) | ||||
| pack = self.createPack(revisions) | pack = self.createPack(revisions) | ||||
| if self.paramsavailable: | if self.paramsavailable: | ||||
| 100, | 100, | ||||
| 1000, | 1000, | ||||
| 10000, | 10000, | ||||
| 100000, | 100000, | ||||
| 1000000, | 1000000, | ||||
| ] | ] | ||||
| for packsize in packsizes: | for packsize in packsizes: | ||||
| revisions = [] | revisions = [] | ||||
| for i in xrange(packsize): | for i in pycompat.xrange(packsize): | ||||
| filename = "filename-%s" % i | filename = "filename-%s" % i | ||||
| content = "content-%s" % i | content = "content-%s" % i | ||||
| node = self.getHash(content) | node = self.getHash(content) | ||||
| revisions.append((filename, node, nullid, content)) | revisions.append((filename, node, nullid, content)) | ||||
| path = self.createPack(revisions).path | path = self.createPack(revisions).path | ||||
| # Perf of large multi-get | # Perf of large multi-get | ||||