@@ -136,28 +136,29 @@ class CompareController(BaseRepoControll
if ancestors:
# pick arbitrary ancestor - but there is usually only one
ancestor = hgrepo[ancestors[0]].hex()
else:
# TODO: have both + and - changesets
revs = ["id('%s') :: id('%s') - id('%s')" %
(org_rev, other_rev, org_rev)]
changesets = [other_repo.get_changeset(cs)
for cs in scmutil.revrange(hgrepo, revs)]
elif alias == 'git':
assert org_repo == other_repo, (org_repo, other_repo) # no git support for different repos
assert org_repo == other_repo, ('no support for compare for two '
'different repositories in git')
so, se = org_repo.run_git_command(
'log --reverse --pretty="format: %%H" -s -p %s..%s' % (org_ref[1],
other_ref[1])
'log --reverse --pretty="format: %%H" -s -p %s..%s'
% (org_ref[1], other_ref[1])
)
changesets = [org_repo.get_changeset(cs)
for cs in re.findall(r'[0-9a-fA-F]{40}', so)]
return changesets, ancestor
@LoginRequired()
@HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
'repository.admin')
def index(self, org_ref_type, org_ref, other_ref_type, other_ref):
# org_ref will be evaluated in org_repo
org_repo = c.rhodecode_db_repo.repo_name
@@ -214,44 +215,47 @@ class CompareController(BaseRepoControll
c.org_ref = org_ref[1]
c.other_ref = other_ref[1]
c.org_ref_type = org_ref[0]
c.other_ref_type = other_ref[0]
c.cs_ranges, c.ancestor = self._get_changesets(org_repo.scm_instance.alias,
org_repo.scm_instance, org_ref,
other_repo.scm_instance, other_ref,
merge)
c.statuses = c.rhodecode_db_repo.statuses([x.raw_id for x in
c.cs_ranges])
if not c.ancestor:
log.warning('Unable to find ancestor revision')
if partial:
assert c.ancestor
return render('compare/compare_cs.html')
if c.ancestor:
assert merge
# case we want a simple diff without incoming changesets,
# previewing what will be merged.
# Make the diff on the other repo (which is known to have other_ref)
log.debug('Using ancestor %s as org_ref instead of %s'
% (c.ancestor, org_ref))
org_ref = ('rev', c.ancestor)
org_repo = other_repo
diff_limit = self.cut_off_limit if not c.fulldiff else None
log.debug('running diff between %s@%s and %s@%s'
% (org_repo.scm_instance.path, org_ref,
other_repo.scm_instance.path, other_ref))
_diff = org_repo.scm_instance.get_diff(rev1=safe_str(org_ref[1]), rev2=safe_str(other_ref[1]))
_diff = org_repo.scm_instance.get_diff(rev1=safe_str(org_ref[1]),
rev2=safe_str(other_ref[1]))
diff_processor = diffs.DiffProcessor(_diff or '', format='gitdiff',
diff_limit=diff_limit)
_parsed = diff_processor.prepare()
c.limited_diff = False
if isinstance(_parsed, LimitedDiffContainer):
c.limited_diff = True
c.files = []
c.changes = {}
c.lines_added = 0
Status change: