Changeset - bd5420ea396b
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 13 years ago 2013-02-19 23:42:37
marcin@python-works.com
better handling of EmptyChangeset case in cherry pick pull request
2 files changed with 13 insertions and 4 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/compare.py
Show inline comments
 
@@ -134,13 +134,13 @@ class CompareController(BaseRepoControll
 
            #other_ref = ('rev', rev_end)
 
            c.org_ref = rev_start[:12]
 
            c.other_ref = rev_end[:12]
 
            # get parent of
 
            # rev start to include it in the diff
 
            _cs = other_repo.scm_instance.get_changeset(rev_start)
 
            rev_start = _cs.parents[0].raw_id if _cs.parents else EmptyChangeset()
 
            rev_start = _cs.parents[0].raw_id if _cs.parents else EmptyChangeset().raw_id
 
            org_ref = ('rev', rev_start)
 
            other_ref = ('rev', rev_end)
 
            #if we cherry pick it's not remote, make the other_repo org_repo
 
            org_repo = other_repo
 

	
 
        c.cs_ranges, ancestor = PullRequestModel().get_compare_data(
rhodecode/model/pull_request.py
Show inline comments
 
@@ -36,12 +36,13 @@ from rhodecode.model.db import PullReque
 
    ChangesetStatus
 
from rhodecode.model.notification import NotificationModel
 
from rhodecode.lib.utils2 import safe_unicode
 

	
 
from rhodecode.lib.vcs.utils.hgcompat import scmutil
 
from rhodecode.lib.vcs.utils import safe_str
 
from rhodecode.lib.vcs.backends.base import EmptyChangeset
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class PullRequestModel(BaseModel):
 

	
 
@@ -177,19 +178,27 @@ class PullRequestModel(BaseModel):
 
            _revset_predicates = {
 
                    'branch': 'branch',
 
                    'book': 'bookmark',
 
                    'tag': 'tag',
 
                    'rev': 'id',
 
                }
 

	
 
            org_rev_spec = "%s('%s')" % (_revset_predicates[org_ref[0]],
 
                                         safe_str(org_ref[1]))
 
            org_rev = scmutil.revsingle(org_repo._repo,
 
                                         org_rev_spec)
 
            if org_ref[1] == EmptyChangeset().raw_id:
 
                org_rev = org_ref[1]
 
            else:
 
                org_rev = org_repo._repo[scmutil.revrange(org_repo._repo,
 
                                                          [org_rev_spec])[-1]]
 
            other_rev_spec = "%s('%s')" % (_revset_predicates[other_ref[0]],
 
                                           safe_str(other_ref[1]))
 
            other_rev = scmutil.revsingle(other_repo._repo, other_rev_spec)
 
            if other_ref[1] == EmptyChangeset().raw_id:
 
                other_rev = other_ref[1]
 
            else:
 
                other_rev = other_repo._repo[scmutil.revrange(other_repo._repo,
 
                                                        [other_rev_spec])[-1]]
 

	
 
            #case two independent repos
 
            if org_repo != other_repo:
 
                hgrepo = unionrepo.unionrepository(other_repo.baseui,
 
                                                   other_repo.path,
 
                                                   org_repo.path)
0 comments (0 inline, 0 general)