diff --git a/benchmarks/basic_commands.py b/benchmarks/basic_commands.py index 985612958032c4508d12f9c6aa80672ac5e9b0c1_YmVuY2htYXJrcy9iYXNpY19jb21tYW5kcy5weQ==..d0c320751e22aba0f2685ad865c775b8da453167_YmVuY2htYXJrcy9iYXNpY19jb21tYW5kcy5weQ== 100644 --- a/benchmarks/basic_commands.py +++ b/benchmarks/basic_commands.py @@ -141,7 +141,7 @@ class BaseExchangeTimeSuite(BaseTimeTestSuite): param_names = BaseTimeTestSuite.param_names + ['strip', 'revset'] - params = BaseTimeTestSuite.params + [['last(all(), 10)']] + [[None, 'default']] + params = BaseTimeTestSuite.params + [['same', 'last(all(), 10)']] + [[None, 'default']] def setup(self, repo_name, strip, revset): self.timer = timeit.default_timer @@ -163,9 +163,9 @@ cmd = [self.hgpath, '--cwd', self.clone_path, 'incoming', self.repo_path] if self.rev: cmd.extend(['-r', self.rev]) - self._single_execute(cmd) + self._single_execute(cmd, expected_return_code=1 if strip == "same" else 0) def time_outgoing(self, repo_name, strip, revset): cmd = [self.hgpath, '--cwd', self.repo_path, 'outgoing', self.clone_path] if self.rev: cmd.extend(['-r', self.rev]) @@ -167,9 +167,9 @@ def time_outgoing(self, repo_name, strip, revset): cmd = [self.hgpath, '--cwd', self.repo_path, 'outgoing', self.clone_path] if self.rev: cmd.extend(['-r', self.rev]) - self._single_execute(cmd) + self._single_execute(cmd, expected_return_code=1 if strip == "same" else 0) class PushPullTimeSuite(BaseExchangeTimeSuite): @@ -196,7 +196,7 @@ self.tmp_clone_path] if self.rev: cmd.extend(['-r', self.rev]) - self._single_execute(cmd) + self._single_execute(cmd, expected_return_code=1 if strip == "same" else 0) # class CloneTrackSuite(BaseTrackTestSuite): diff --git a/benchmarks/utils.py b/benchmarks/utils.py index 985612958032c4508d12f9c6aa80672ac5e9b0c1_YmVuY2htYXJrcy91dGlscy5weQ==..d0c320751e22aba0f2685ad865c775b8da453167_YmVuY2htYXJrcy91dGlscy5weQ== 100644 --- a/benchmarks/utils.py +++ b/benchmarks/utils.py @@ -220,9 +220,13 @@ return cmd - def _single_execute(self, cmd): - return subprocess.check_output(cmd, stderr=subprocess.STDOUT, - env=self.environ) + def _single_execute(self, cmd, expected_return_code=0): + try: + subprocess.check_output(cmd, stderr=subprocess.STDOUT, + env=self.environ) + except subprocess.CalledProcessError as exc: + if exc.returncode != expected_return_code: + raise class BaseNChangesetsTestSuite(BaseTimeTestSuite): diff --git a/prepare_repos.py b/prepare_repos.py index 985612958032c4508d12f9c6aa80672ac5e9b0c1_cHJlcGFyZV9yZXBvcy5weQ==..d0c320751e22aba0f2685ad865c775b8da453167_cHJlcGFyZV9yZXBvcy5weQ== 100644 --- a/prepare_repos.py +++ b/prepare_repos.py @@ -9,7 +9,7 @@ import yaml # changesets stripped in partial clones -PARTIAL_REVSET = ('last(all(), 10)',) +PARTIAL_REVSET = ("same", 'last(all(), 10)',) def read_configuration(config_path): @@ -33,7 +33,8 @@ partialdir = join(cachedir, 'partial-{}-{}'.format( repo_name, base64.b64encode(revset))) if not isdir(partialdir): - print("Cloning partial %s (%s stripped off %s) into %s (for exchange benchmarks)" % ( - repo_name, clonedir, revset, partialdir)) + print("Cloning %s (%s%s) into %s (for exchange benchmarks)" % ( + repo_name, clonedir, + " stripped of %s" % (revset,) if revset != "same" else "", partialdir)) subprocess.check_call(['hg', 'clone', '--noupdate', clonedir, partialdir]) @@ -38,8 +39,9 @@ subprocess.check_call(['hg', 'clone', '--noupdate', clonedir, partialdir]) - subprocess.check_call(['hg', '--cwd', partialdir, 'strip', '-r', - revset]) - subprocess.check_call(['hg', '--cwd', partialdir, 'debugupdatecache']) + if revset != "same": + subprocess.check_call(['hg', '--cwd', partialdir, 'strip', '-r', + revset]) + subprocess.check_call(['hg', '--cwd', partialdir, 'debugupdatecache']) config = read_configuration("config.yaml")