comparison rhodecode/model/pull_request.py @ 3322:c9b0f1d363c7 beta

compare: swap org and other when they refer to different repos, ie are pull request style Pull requests will have a different from/to description - but in a consistent and slightly better way that can be improved later. A pull request diff is empathic: "How will this look for the peer I'm proposing to" style.
author Mads Kiilerich <madski@unity3d.com>
date Fri, 01 Feb 2013 23:13:10 +0100
parents fc08484c5bf3
children a07296564f6b
comparison
equal deleted inserted replaced
3321:a91fa221a3b8 3322:c9b0f1d363c7
188 safe_str(other_ref[1])) 188 safe_str(other_ref[1]))
189 other_rev = scmutil.revsingle(other_repo._repo, other_rev_spec) 189 other_rev = scmutil.revsingle(other_repo._repo, other_rev_spec)
190 190
191 #case two independent repos 191 #case two independent repos
192 if org_repo != other_repo: 192 if org_repo != other_repo:
193 hgrepo = unionrepo.unionrepository(org_repo.baseui, 193 hgrepo = unionrepo.unionrepository(other_repo.baseui,
194 org_repo.path, 194 other_repo.path,
195 other_repo.path) 195 org_repo.path)
196 revs = ["ancestors(id('%s')) and not ancestors(id('%s'))" % 196 # all the changesets we are looking for will be in other_repo,
197 (org_rev, other_rev)] 197 # so rev numbers from hgrepo can be used in other_repo
198 198
199 #no remote compare do it on the same repository 199 #no remote compare do it on the same repository
200 else: 200 else:
201 hgrepo = org_repo._repo 201 hgrepo = other_repo._repo
202 revs = ["ancestors(id('%s')) and not ancestors(id('%s'))" % 202
203 (other_rev, org_rev)] 203 revs = ["ancestors(id('%s')) and not ancestors(id('%s'))" %
204 204 (other_rev, org_rev)]
205 out = scmutil.revrange(hgrepo, revs) 205 out = scmutil.revrange(hgrepo, revs)
206 for cs in (out): 206 for cs in (out):
207 changesets.append(org_repo.get_changeset(cs)) 207 changesets.append(other_repo.get_changeset(cs))
208 208
209 elif alias == 'git': 209 elif alias == 'git':
210 assert org_repo == other_repo, (org_repo, other_repo) # no git support for different repos 210 assert org_repo == other_repo, (org_repo, other_repo) # no git support for different repos
211 so, se = org_repo.run_git_command( 211 so, se = org_repo.run_git_command(
212 'log --reverse --pretty="format: %%H" -s -p %s..%s' % (org_ref[1], 212 'log --reverse --pretty="format: %%H" -s -p %s..%s' % (org_ref[1],