⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 actions.py

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 PY
📖 第 1 页 / 共 3 页
字号:
  mytree = tree.build_tree_from_wc (export_dir_name, ignore_svn=0)  # Verify expected disk against actual disk.  tree.compare_trees (mytree, disk_tree,                      singleton_handler_a, a_baton,                      singleton_handler_b, b_baton)def verify_update(actual_output, wc_dir_name,                  output_tree, disk_tree, status_tree,                  singleton_handler_a, a_baton,                  singleton_handler_b, b_baton,                  check_props):  """Verify update of WC_DIR_NAME.  The subcommand output (found in ACTUAL_OUTPUT) will be verified  against OUTPUT_TREE, and the working copy itself will be verified  against DISK_TREE.  If optional STATUS_OUTPUT_TREE is given, then  'svn status' output will be compared.  (This is a good way to check  that revision numbers were bumped.)  SINGLETON_HANDLER_A and  SINGLETON_HANDLER_B will be passed to tree.compare_trees - see that  function's doc string for more details.  If CHECK_PROPS is set, then  disk comparison will examine props.  Returns if successful, raises  on failure."""  # Verify actual output against expected output.  tree.compare_trees (actual_output, output_tree)  # Create a tree by scanning the working copy  mytree = tree.build_tree_from_wc (wc_dir_name, check_props)  # Verify expected disk against actual disk.  tree.compare_trees (mytree, disk_tree,                      singleton_handler_a, a_baton,                      singleton_handler_b, b_baton)  # Verify via 'status' command too, if possible.  if status_tree:    run_and_verify_status(wc_dir_name, status_tree)def run_and_verify_update(wc_dir_name,                          output_tree, disk_tree, status_tree,                          error_re_string = None,                          singleton_handler_a = None,                          a_baton = None,                          singleton_handler_b = None,                          b_baton = None,                          check_props = 0,                          *args):  """Update WC_DIR_NAME.  *ARGS are any extra optional args to the  update subcommand.  NOTE: If *ARGS is specified at all, explicit  target paths must be passed in *ARGS as well (or a default `.' will  be chosen by the 'svn' binary).  This allows the caller to update  many items in a single working copy dir, but still verify the entire  working copy dir.  If ERROR_RE_STRING, the update must exit with error, and the error  message must match regular expression ERROR_RE_STRING.  Else if ERROR_RE_STRING is None, then:  The subcommand output will be verified against OUTPUT_TREE, and the  working copy itself will be verified against DISK_TREE.  If optional  STATUS_TREE is given, then 'svn status' output will be compared.  (This is a good way to check that revision numbers were bumped.)  SINGLETON_HANDLER_A and SINGLETON_HANDLER_B will be passed to  tree.compare_trees - see that function's doc string for more  details.  If CHECK_PROPS is set, then disk comparison will examine props.  Returns if successful, raises on failure."""  if isinstance(output_tree, wc.State):    output_tree = output_tree.old_tree()  if isinstance(disk_tree, wc.State):    disk_tree = disk_tree.old_tree()  if isinstance(status_tree, wc.State):    status_tree = status_tree.old_tree()  # Update and make a tree of the output.  if len(args):    output, errput = main.run_svn (error_re_string, 'up', *args)  else:    output, errput = main.run_svn (error_re_string, 'up', wc_dir_name, *args)  if (error_re_string):    rm = re.compile(error_re_string)    for line in errput:      match = rm.search(line)      if match:        return    raise main.SVNUnmatchedError  mytree = tree.build_tree_from_checkout (output)  verify_update (mytree, wc_dir_name,                 output_tree, disk_tree, status_tree,                 singleton_handler_a, a_baton,                 singleton_handler_b, b_baton,                 check_props)def run_and_verify_merge(dir, rev1, rev2, url,                         output_tree, disk_tree, status_tree, skip_tree,                         error_re_string = None,                         singleton_handler_a = None,                         a_baton = None,                         singleton_handler_b = None,                         b_baton = None,                         check_props = 0,                         dry_run = 1,                         *args):  """Run 'svn merge -rREV1:REV2 URL DIR'."""  if args:    run_and_verify_merge2(dir, rev1, rev2, url, None, output_tree, disk_tree,                          status_tree, skip_tree, error_re_string,                          singleton_handler_a, a_baton, singleton_handler_b,                          b_baton, check_props, dry_run, *args)  else:    run_and_verify_merge2(dir, rev1, rev2, url, None, output_tree, disk_tree,                          status_tree, skip_tree, error_re_string,                          singleton_handler_a, a_baton, singleton_handler_b,                          b_baton, check_props, dry_run)def run_and_verify_merge2(dir, rev1, rev2, url1, url2,                          output_tree, disk_tree, status_tree, skip_tree,                          error_re_string = None,                          singleton_handler_a = None,                          a_baton = None,                          singleton_handler_b = None,                          b_baton = None,                          check_props = 0,                          dry_run = 1,                          *args):  """Run 'svn merge URL1@REV1 URL2@REV2 DIR' if URL2 is not None  (for a three-way merge between URLs and WC).  If URL2 is None, run 'svn merge -rREV1:REV2 URL1 DIR'.  If ERROR_RE_STRING, the merge must exit with error, and the error  message must match regular expression ERROR_RE_STRING.  Else if ERROR_RE_STRING is None, then:  The subcommand output will be verified against OUTPUT_TREE, and the  working copy itself will be verified against DISK_TREE.  If optional  STATUS_TREE is given, then 'svn status' output will be compared.  The 'skipped' merge output will be compared to SKIP_TREE.  SINGLETON_HANDLER_A and SINGLETON_HANDLER_B will be passed to  tree.compare_trees - see that function's doc string for more  details.  If CHECK_PROPS is set, then disk comparison will examine props.  If DRY_RUN is set then a --dry-run merge will be carried out first and  the output compared with that of the full merge.  Returns if successful, raises on failure."""  if isinstance(output_tree, wc.State):    output_tree = output_tree.old_tree()  if isinstance(disk_tree, wc.State):    disk_tree = disk_tree.old_tree()  if isinstance(status_tree, wc.State):    status_tree = status_tree.old_tree()  if isinstance(skip_tree, wc.State):    skip_tree = skip_tree.old_tree()  if url2:    merge_command = ("merge", url1 + "@" + str(rev1),url2 + "@" + str(rev2),                     dir)  else:    merge_command = ("merge", "-r", str(rev1) + ":" + str(rev2), url1, dir)  if dry_run:    pre_disk = tree.build_tree_from_wc(dir)    dry_run_command = merge_command + ('--dry-run',)    dry_run_command = dry_run_command + args    out_dry, err_dry = main.run_svn(error_re_string, *dry_run_command)    post_disk = tree.build_tree_from_wc(dir)    try:      tree.compare_trees(post_disk, pre_disk)    except tree.SVNTreeError:      print "============================================================="      print "Dry-run merge altered working copy"      print "============================================================="      raise  # Update and make a tree of the output.  merge_command = merge_command + args  out, err = main.run_svn (error_re_string, *merge_command)  if (error_re_string):    rm = re.compile(error_re_string)    for line in err:      match = rm.search(line)      if match:        return    raise main.SVNUnmatchedError  elif err:    ### we should raise a less generic error here. which?    raise Failure(err)  if dry_run and out != out_dry:    print "============================================================="    print "Merge outputs differ"    print "The dry-run merge output:"    map(sys.stdout.write, out_dry)    print "The full merge output:"    map(sys.stdout.write, out)    print "============================================================="    raise main.SVNUnmatchedError  def missing_skip(a, b):    print "============================================================="    print "Merge failed to skip: " + a.path    print "============================================================="    raise Failure  def extra_skip(a, b):    print "============================================================="    print "Merge unexpectedly skipped: " + a.path    print "============================================================="    raise Failure  myskiptree = tree.build_tree_from_skipped(out)  tree.compare_trees(myskiptree, skip_tree,                     extra_skip, None, missing_skip, None)  mytree = tree.build_tree_from_checkout(out)  verify_update (mytree, dir,                 output_tree, disk_tree, status_tree,                 singleton_handler_a, a_baton,                 singleton_handler_b, b_baton,                 check_props)def run_and_verify_switch(wc_dir_name,                          wc_target,                          switch_url,                          output_tree, disk_tree, status_tree,                          singleton_handler_a = None,                          a_baton = None,                          singleton_handler_b = None,                          b_baton = None,                          check_props = 0):  """Switch WC_TARGET (in working copy dir WC_DIR_NAME) to SWITCH_URL.  The subcommand output will be verified against OUTPUT_TREE, and the  working copy itself will be verified against DISK_TREE.  If optional  STATUS_OUTPUT_TREE is given, then 'svn status' output will be  compared.  (This is a good way to check that revision numbers were  bumped.)  SINGLETON_HANDLER_A and SINGLETON_HANDLER_B will be passed to  tree.compare_trees - see that function's doc string for more details.  If CHECK_PROPS is set, then disk comparison will examine props.  Returns if successful, raises on failure."""  if isinstance(output_tree, wc.State):    output_tree = output_tree.old_tree()  if isinstance(disk_tree, wc.State):    disk_tree = disk_tree.old_tree()  if isinstance(status_tree, wc.State):    status_tree = status_tree.old_tree()  # Update and make a tree of the output.  output, errput = main.run_svn (None, 'switch',                                 '--username', main.wc_author,                                 '--password', main.wc_passwd,                                 switch_url, wc_target)  mytree = tree.build_tree_from_checkout (output)  verify_update (mytree, wc_dir_name,                 output_tree, disk_tree, status_tree,                 singleton_handler_a, a_baton,                 singleton_handler_b, b_baton,                 check_props)def run_and_verify_commit(wc_dir_name, output_tree, status_output_tree,                          error_re_string = None,                          singleton_handler_a = None,                          a_baton = None,                          singleton_handler_b = None,                          b_baton = None,                          *args):  """Commit and verify results within working copy WC_DIR_NAME,  sending ARGS to the commit subcommand.  The subcommand output will be verified against OUTPUT_TREE.  If  optional STATUS_OUTPUT_TREE is given, then 'svn status' output will  be compared.  (This is a good way to check that revision numbers  were bumped.)  If ERROR_RE_STRING is None, the commit must not exit with error.  If  ERROR_RE_STRING is a string, the commit must exit with error, and  the error message must match regular expression ERROR_RE_STRING.  SINGLETON_HANDLER_A and SINGLETON_HANDLER_B will be passed to  tree.compare_trees - see that function's doc string for more  details.  Returns if successful, raises on failure."""  if isinstance(output_tree, wc.State):    output_tree = output_tree.old_tree()  if isinstance(status_output_tree, wc.State):    status_output_tree = status_output_tree.old_tree()  # Commit.  output, errput = main.run_svn(error_re_string, 'ci',

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -