def testPushGitChangesWithRealPrep(self):
     """Another push test that tests push but on non-repo does it on a branch."""
     manifest_versions_url = cbuildbot_config.GetManifestVersionsRepoUrl(
         internal_build=False, read_only=False)
     git_dir = os.path.join(constants.SOURCE_ROOT, 'manifest-versions')
     manifest_version.RefreshManifestCheckout(git_dir,
                                              manifest_versions_url)
     git.CreatePushBranch(manifest_version.PUSH_BRANCH, git_dir, sync=False)
     cros_build_lib.RunCommand(
         ('tee --append %s/AUTHORS' % git_dir).split(),
         input='TEST USER <*****@*****.**>')
     manifest_version._PushGitChanges(git_dir,
                                      'Test appending user.',
                                      dry_run=True)
    def CommonTestIncrementVersion(self, incr_type, version):
        """Common test increment.  Returns path to new incremented file."""
        message = 'Incrementing cuz I sed so'
        self.mox.StubOutWithMock(git, 'CreatePushBranch')
        self.mox.StubOutWithMock(manifest_version, '_PushGitChanges')
        self.mox.StubOutWithMock(git, 'CleanAndCheckoutUpstream')

        git.CreatePushBranch(manifest_version.PUSH_BRANCH, self.tempdir)

        version_file = self.CreateFakeVersionFile(self.tempdir, version)

        manifest_version._PushGitChanges(self.tempdir, message, dry_run=False)

        git.CleanAndCheckoutUpstream(self.tempdir)
        self.mox.ReplayAll()
        info = manifest_version.VersionInfo(version_file=version_file,
                                            incr_type=incr_type)
        info.IncrementVersion(message, dry_run=False)
        self.mox.VerifyAll()
        return version_file
  def CommonTestIncrementVersion(self, incr_type, version):
    """Common test increment.  Returns path to new incremented file."""
    message = 'Incrementing cuz I sed so'
    self.mox.StubOutWithMock(git, 'CreatePushBranch')
    self.mox.StubOutWithMock(manifest_version, '_PushGitChanges')
    self.mox.StubOutWithMock(git, 'CleanAndCheckoutUpstream')

    git.CreatePushBranch(manifest_version.PUSH_BRANCH, self.tempdir)

    version_file = self.CreateFakeVersionFile(self.tempdir, version)

    manifest_version._PushGitChanges(self.tempdir, message, dry_run=False)

    git.CleanAndCheckoutUpstream(self.tempdir)
    self.mox.ReplayAll()
    info = manifest_version.VersionInfo(version_file=version_file,
                                        incr_type=incr_type)
    info.IncrementVersion(message, dry_run=False)
    self.mox.VerifyAll()
    return version_file