Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 def test_pull(self, run_subprocess):
     run_subprocess.return_value = False
     git.pull("/src", remote="my-origin", branch="feature-branch")
     calls = [
         mock.call("git -C /src fetch --quiet my-origin"),
         mock.call("git -C /src checkout --quiet feature-branch"),
         mock.call("git -C /src rebase --quiet my-origin/feature-branch")
     ]
     run_subprocess.assert_has_calls(calls)
Exemplo n.º 3
0
 def test_pull(self, run_subprocess):
     run_subprocess.return_value = False
     git.pull("/src", remote="my-origin", branch="feature-branch")
     calls = [
         mock.call("git -C /src fetch --quiet my-origin"),
         mock.call("git -C /src checkout --quiet feature-branch"),
         mock.call("git -C /src rebase --quiet my-origin/feature-branch")
     ]
     run_subprocess.assert_has_calls(calls)
Exemplo n.º 4
0
 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))
Exemplo n.º 5
0
 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))
Exemplo n.º 6
0
 def test_pull(self, run_subprocess_with_logging):
     run_subprocess_with_logging.return_value = 0
     git.pull("/src", remote="my-origin", branch="feature-branch")
     calls = [
         # pull
         mock.call("git -C /src --version", level=logging.DEBUG),
         # fetch
         mock.call("git -C /src --version", level=logging.DEBUG),
         mock.call("git -C /src fetch --prune --tags my-origin"),
         # rebase
         mock.call("git -C /src --version", level=logging.DEBUG),
         # checkout
         mock.call("git -C /src --version", level=logging.DEBUG),
         mock.call("git -C /src checkout feature-branch"),
         mock.call("git -C /src rebase my-origin/feature-branch"),
     ]
     run_subprocess_with_logging.assert_has_calls(calls)