##// END OF EJS Templates
pull request: use unionrepo instead of outgoing...
Mads Kiilerich -
r3303:ae5ac36c beta
parent child Browse files
Show More
@@ -24,22 +24,20 b''
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25
25
26 import logging
26 import logging
27 import binascii
28 import datetime
27 import datetime
29 import re
28 import re
30
29
31 from pylons.i18n.translation import _
30 from pylons.i18n.translation import _
32
31
33 from rhodecode.model.meta import Session
32 from rhodecode.model.meta import Session
34 from rhodecode.lib import helpers as h
33 from rhodecode.lib import helpers as h, unionrepo
35 from rhodecode.model import BaseModel
34 from rhodecode.model import BaseModel
36 from rhodecode.model.db import PullRequest, PullRequestReviewers, Notification,\
35 from rhodecode.model.db import PullRequest, PullRequestReviewers, Notification,\
37 ChangesetStatus
36 ChangesetStatus
38 from rhodecode.model.notification import NotificationModel
37 from rhodecode.model.notification import NotificationModel
39 from rhodecode.lib.utils2 import safe_unicode
38 from rhodecode.lib.utils2 import safe_unicode
40
39
41 from rhodecode.lib.vcs.utils.hgcompat import discovery, localrepo, scmutil, \
40 from rhodecode.lib.vcs.utils.hgcompat import scmutil
42 findcommonoutgoing
43 from rhodecode.lib.vcs.utils import safe_str
41 from rhodecode.lib.vcs.utils import safe_str
44
42
45 log = logging.getLogger(__name__)
43 log = logging.getLogger(__name__)
@@ -192,35 +190,21 b' class PullRequestModel(BaseModel):'
192
190
193 #case two independent repos
191 #case two independent repos
194 if org_repo != other_repo:
192 if org_repo != other_repo:
195 revs = [
193 hgrepo = unionrepo.unionrepository(org_repo.baseui,
196 org_repo._repo.lookup(org_ref[1]),
194 org_repo.path,
197 org_repo._repo.lookup(other_ref[1]), # lookup up in the wrong repo!
195 other_repo.path)
198 ]
196 revs = ["ancestors(id('%s')) and not ancestors(id('%s'))" %
199
197 (org_rev, other_rev)]
200 obj = findcommonoutgoing(org_repo._repo,
201 localrepo.locallegacypeer(other_repo._repo.local()),
202 revs,
203 force=True)
204 revs = obj.missing
205
206 for cs in map(binascii.hexlify, revs):
207 _cs = org_repo.get_changeset(cs)
208 changesets.append(_cs)
209 # in case we have revisions filter out the ones not in given range
210 if org_ref[0] == 'rev' and other_ref[0] == 'rev':
211 revs = [x.raw_id for x in changesets]
212 start = org_ref[1]
213 stop = other_ref[1]
214 changesets = changesets[revs.index(start):revs.index(stop) + 1]
215
198
216 #no remote compare do it on the same repository
199 #no remote compare do it on the same repository
217 else:
200 else:
201 hgrepo = org_repo._repo
218 revs = ["ancestors(id('%s')) and not ancestors(id('%s'))" %
202 revs = ["ancestors(id('%s')) and not ancestors(id('%s'))" %
219 (other_rev, org_rev)]
203 (other_rev, org_rev)]
220
204
221 out = scmutil.revrange(org_repo._repo, revs)
205 out = scmutil.revrange(hgrepo, revs)
222 for cs in (out):
206 for cs in (out):
223 changesets.append(org_repo.get_changeset(cs))
207 changesets.append(org_repo.get_changeset(cs))
224
208
225 elif alias == 'git':
209 elif alias == 'git':
226 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
General Comments 0
You need to be logged in to leave comments. Login now