2013-05-21 101 views
0

我如何使用pysvn.client合并相关的功能来实现摘樱桃合并,如何使用pysvn.Client.merge_peg2实现摘樱桃从一个合并

合并特定版本(或修订范围)分支到另一个,

svn merge [-c M[,N...] | -r N:M ...] SOURCE[@REV] [TARGET_WCPATH] 

现在我使用pysvn.Client.merge_peg2(http://pysvn.tigris.org/docs/pysvn_prog_ref.html#pysvn_client_merge_peg2),没有警告和错误,但不能工作。

我很迷惑有关merge_peg2及其参数

merge_peg2(sources, 
    ranges_to_merge, 
    peg_revision, 
    tareget_wcpath, 
    depth=depth, 
    notice_ancestry=False, 
    force=False, 
    dry_run=False, 
    record_only=True, 
    merge_options=[]) 

sources   # the source repo url which merge from? 
ranges_to_merge #"a list of tuples with the start and end revisions to be merged"?how can I generate this revision range? 
peg_revision #pysvn.Revision(pysvn.opt_revision_kind.unspecified) is ok? 
tareget_wcpath #I fill this with the dest local repo 

任何建议,例子或其他解决方案?

回答

1

这是我做樱桃采摘合并。对您选择的修订进行排序并对此进行迭代。

def merge_to_wc(r): 
    WC_PATH = '.' 
    FROM_URL = 'https:/svn.somewhere.org/my_project/branches/1.0' 

    pysvn.merge_peg(
    FROM_URL, 
    pysvn.Revision(pysvn.opt_revision_kind.number, r-1), 
    pysvn.Revision(pysvn.opt_revision_kind.number, r), 
    pysvn.Revision(pysvn.opt_revision_kind.head), 
    WC_PATH) 

该方法通过反复试验才发现,搜索互联网,猜测,和许多咬牙切齿。