예제 #1
0
  def _setup_pants_repo(self):
    """Cleans the pants repo and applies patches, yielding the Git command for the repo."""
    git = PantsGit()

    if self.use_dirty:
      yield git
      raise StopIteration

    if not git.is_clean():
        raise RunError('Pants source not clean: please stash or commit changes in {}.'
                       .format(git.cwd))
    self._assert_square_exists(git)
    pants_upstream = self._get_upstream_remote(git)
    git('checkout', 'master')
    git('fetch', pants_upstream)
    git('reset', '--hard', '{}/master'.format(pants_upstream))
    git('clean', '-fdx')
    with git.apply_patches(PANTS_PATCHES, on_branch=SQUARE_RELEASE_BRANCH, commit=True):
      git('push', '-f', 'square')
      BinaryUtils.pause('Patches applied. It is recommended that you run either:"\n'
                        '  full CI:                 {cwd}/build-support/bin/ci.sh\n'
                        '  or just the unit tests:  cd {cwd} ; ./pants test tests/python/pants_test:all\n'
                        'before continuing.'.format(cwd=git.cwd))
      yield git
예제 #2
0
 def run_pants(cls, options, args, patches):
   """Run PANTS_DEV=1 ./pants with the given arguments, after applying the given list of patches.
   """
   git = PantsGit()
   with git.apply_patches(patches, commit=options.commit_patches):
     BinaryUtils.run_dev_pants(args)