def checkout_make_raw_diff(self, from_branch, to_branch, max_diff_size_utf8_bytes): """Return an abdt_differ.DiffResult of the changes on the branch. If the diff would exceed the pre-specified max diff size then take measures to reduce the diff. Potentially checkout onto the 'to_branch' so that changes to .gitattributes files will be considered. :from_branch: string name of the merge-base of 'branch' :to_branch: string name of the branch to diff :max_diff_size_utf8_bytes: the maximum allowed size of the diff as utf8 :returns: the string diff of the changes on the branch """ if not phlgitu_ref.is_fq(from_branch): raise ValueError("not fully qualifed: {}".format(from_branch)) if not phlgitu_ref.is_fq(to_branch): raise ValueError("not fully qualifed: {}".format(from_branch)) key = self._make_key(from_branch, to_branch, max_diff_size_utf8_bytes) if key in self._diff_results: raise self._diff_results[key] # checkout the 'to' branch, otherwise we won't take into account any # changes to .gitattributes files phlgit_checkout.branch(self._repo, to_branch) try: return abdt_differ.make_raw_diff(self._repo, from_branch, to_branch, max_diff_size_utf8_bytes) except abdt_differ.NoDiffError as e: self._diff_results[key] = e raise
def process(args): repo_path = os.path.abspath(os.curdir) base = args.base head = args.head repo = phlsys_git.Repo(repo_path) # TODO: do not use private variable abdt_branch._MAX_DIFF_SIZE diff = abdt_differ.make_raw_diff(repo, base, head, abdt_branch._MAX_DIFF_SIZE) sys.stdout.write(diff.diff)
def process(args): repo_path = os.path.abspath(os.curdir) base = args.base head = args.head repo = phlsys_git.Repo(repo_path) # TODO: do not use private variable abdt_branch._MAX_DIFF_SIZE diff = abdt_differ.make_raw_diff( repo, base, head, abdt_branch._MAX_DIFF_SIZE) sys.stdout.write(diff.diff)
def make_raw_diff(self): """Return a string raw diff of the changes on the branch. If the diff would exceed the pre-specified max diff size then take measures to reduce the diff. """ return abdt_differ.make_raw_diff( self._clone, self._review_branch.remote_base, self._review_branch.remote_branch, _MAX_DIFF_SIZE )
def make_raw_diff(self): """Return an abdt_differ.DiffResult of the changes on the branch. If the diff would exceed the pre-specified max diff size then take measures to reduce the diff. """ # checkout the 'to' branch, otherwise we won't take into account any # changes to .gitattributes files phlgit_checkout.branch(self._repo, self._review_branch.remote_branch) try: return abdt_differ.make_raw_diff( self._repo, self._review_branch.remote_base, self._review_branch.remote_branch, _MAX_DIFF_SIZE) except abdt_differ.NoDiffError: raise abdt_exception.NoDiffException( self.base_branch_name(), self.review_branch_name(), self.review_branch_hash())
def checkout_make_raw_diff(self, from_branch, to_branch, max_diff_size_utf8_bytes): """Return an abdt_differ.DiffResult of the changes on the branch. If the diff would exceed the pre-specified max diff size then take measures to reduce the diff. Potentially checkout onto the 'to_branch' so that changes to .gitattributes files will be considered. :from_branch: string name of the merge-base of 'branch' :to_branch: string name of the branch to diff :max_diff_size_utf8_bytes: the maximum allowed size of the diff as utf8 :returns: the string diff of the changes on the branch """ if not phlgitu_ref.is_fq(from_branch): raise ValueError('not fully qualifed: {}'.format(from_branch)) if not phlgitu_ref.is_fq(to_branch): raise ValueError('not fully qualifed: {}'.format(from_branch)) key = self._make_key(from_branch, to_branch, max_diff_size_utf8_bytes) if key in self._diff_results: raise self._diff_results[key] # checkout the 'to' branch, otherwise we won't take into account any # changes to .gitattributes files phlgit_checkout.branch(self._repo, to_branch) try: return abdt_differ.make_raw_diff(self._repo, from_branch, to_branch, max_diff_size_utf8_bytes) except abdt_differ.NoDiffError as e: self._diff_results[key] = e raise
def make_diff(max_bytes): return abdt_differ.make_raw_diff( worker.repo, "master", "diff_branch", max_bytes)
def make_diff(max_bytes): return abdt_differ.make_raw_diff(worker.repo, "master", "diff_branch", max_bytes)