Changeset - ae5ac36cdf83
[Not reviewed]
beta
0 1 0
Mads Kiilerich - 13 years ago 2013-01-03 18:05:18
madski@unity3d.com
pull request: use unionrepo instead of outgoing

This makes it possible to look the 'moving target' symbols up in the right repo.

Using a revset with the right revisions also removes the need for pruning
changesets that are outside the requested range.

It will also not be confused by changesets that for some reason has been pulled
to the repo but haven't been merged yet. They are going to be 'merged' by the
'pull' request and should thus be a part of what is reviewed.
1 file changed with 9 insertions and 25 deletions:
0 comments (0 inline, 0 general)
rhodecode/model/pull_request.py
Show inline comments
 
@@ -24,22 +24,20 @@
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import logging
 
import binascii
 
import datetime
 
import re
 

	
 
from pylons.i18n.translation import _
 

	
 
from rhodecode.model.meta import Session
 
from rhodecode.lib import helpers as h
 
from rhodecode.lib import helpers as h, unionrepo
 
from rhodecode.model import BaseModel
 
from rhodecode.model.db import PullRequest, PullRequestReviewers, Notification,\
 
    ChangesetStatus
 
from rhodecode.model.notification import NotificationModel
 
from rhodecode.lib.utils2 import safe_unicode
 

	
 
from rhodecode.lib.vcs.utils.hgcompat import discovery, localrepo, scmutil, \
 
    findcommonoutgoing
 
from rhodecode.lib.vcs.utils.hgcompat import scmutil
 
from rhodecode.lib.vcs.utils import safe_str
 

	
 
log = logging.getLogger(__name__)
 
@@ -192,33 +190,19 @@ class PullRequestModel(BaseModel):
 

	
 
            #case two independent repos
 
            if org_repo != other_repo:
 
                revs = [
 
                    org_repo._repo.lookup(org_ref[1]),
 
                    org_repo._repo.lookup(other_ref[1]), # lookup up in the wrong repo!
 
                ]
 
    
 
                obj = findcommonoutgoing(org_repo._repo,
 
                            localrepo.locallegacypeer(other_repo._repo.local()),
 
                            revs,
 
                            force=True)
 
                revs = obj.missing
 
    
 
                for cs in map(binascii.hexlify, revs):
 
                    _cs = org_repo.get_changeset(cs)
 
                    changesets.append(_cs)
 
                # in case we have revisions filter out the ones not in given range
 
                if org_ref[0] == 'rev' and other_ref[0] == 'rev':
 
                    revs = [x.raw_id for x in changesets]
 
                    start = org_ref[1]
 
                    stop = other_ref[1]
 
                    changesets = changesets[revs.index(start):revs.index(stop) + 1]
 
                hgrepo = unionrepo.unionrepository(org_repo.baseui,
 
                                                   org_repo.path,
 
                                                   other_repo.path)
 
                revs = ["ancestors(id('%s')) and not ancestors(id('%s'))" %
 
                        (org_rev, other_rev)]
 

	
 
            #no remote compare do it on the same repository
 
            else:
 
                hgrepo = org_repo._repo
 
                revs = ["ancestors(id('%s')) and not ancestors(id('%s'))" %
 
                        (other_rev, org_rev)]
 
    
 
                out = scmutil.revrange(org_repo._repo, revs)
 
            out = scmutil.revrange(hgrepo, revs)
 
                for cs in (out):
 
                    changesets.append(org_repo.get_changeset(cs))
 

	
0 comments (0 inline, 0 general)