def test_pull_revision(self, run_subprocess_with_logging, run_subprocess): run_subprocess_with_logging.return_value = 0 run_subprocess.return_value = False git.pull_revision("/src", "3694a07") run_subprocess.assert_called_with( "git -C /src fetch --quiet origin && git -C /src checkout --quiet 3694a07" )
def _update(self, revision): if self.has_remote() and revision == "latest": self.logger.info("Fetching latest sources for %s from origin.", self.name) git.pull(self.src_dir) elif revision == "current": self.logger.info("Skip fetching sources for %s.", self.name) elif self.has_remote() and revision.startswith("@"): # convert timestamp annotated for Rally to something git understands -> we strip leading and trailing " and the @. git_ts_revision = revision[1:] self.logger.info( "Fetching from remote and checking out revision with timestamp [%s] for %s.", git_ts_revision, self.name) git.pull_ts(self.src_dir, git_ts_revision) elif self.has_remote(): # assume a git commit hash self.logger.info( "Fetching from remote and checking out revision [%s] for %s.", revision, self.name) git.pull_revision(self.src_dir, revision) else: self.logger.info("Checking out local revision [%s] for %s.", revision, self.name) git.checkout(self.src_dir, revision) if git.is_working_copy(self.src_dir): git_revision = git.head_revision(self.src_dir) self.logger.info( "User-specified revision [%s] for [%s] results in git revision [%s]", revision, self.name, git_revision) else: self.logger.info( "Skipping git revision resolution for %s (%s is not a git repository).", self.name, self.src_dir)
def test_pull_revision(self, run_subprocess_with_logging, run_subprocess): run_subprocess_with_logging.return_value = 0 run_subprocess.side_effect = [False, False] git.pull_revision("/src", "3694a07") run_subprocess.has_calls([ mock.call("git -C /src fetch --prune --tags --quiet origin"), mock.call("git -C /src checkout --quiet 3694a07"), ])
def _update(self, revision): if revision == "latest": logger.info("Fetching latest sources from origin.") git.pull(self.src_dir) elif revision == "current": logger.info("Skip fetching sources") elif revision.startswith("@"): # convert timestamp annotated for Rally to something git understands -> we strip leading and trailing " and the @. git.pull_ts(self.src_dir, revision[1:]) else: # assume a git commit hash git.pull_revision(self.src_dir, revision) git_revision = git.head_revision(self.src_dir) logger.info("Specified revision [%s] on command line results in git revision [%s]" % (revision, git_revision))
def _update(self, revision): if revision == "latest": logger.info("Fetching latest sources for %s from origin." % self.name) git.pull(self.src_dir) elif revision == "current": logger.info("Skip fetching sources for %s." % self.name) elif revision.startswith("@"): # convert timestamp annotated for Rally to something git understands -> we strip leading and trailing " and the @. git.pull_ts(self.src_dir, revision[1:]) else: # assume a git commit hash git.pull_revision(self.src_dir, revision) git_revision = git.head_revision(self.src_dir) logger.info("Specified revision [%s] for [%s] on command line results in git revision [%s]" % (revision, self.name, git_revision))
def test_pull_revision(self, run_subprocess_with_logging, run_subprocess): run_subprocess_with_logging.return_value = 0 run_subprocess.return_value = False git.pull_revision("/src", "3694a07") run_subprocess.assert_called_with("git -C /src fetch --quiet origin && git -C /src checkout --quiet 3694a07")