Setting Up SVN:Externals with TortoiseSVN in Windows

只谈情不闲聊 提交于 2019-12-08 17:37:59

问题


I'm trying to set up svn:externals with TortoiseSVN on a Windows machine. I have two projects and both repositories have been already created on the same local machine.

The current structure looks like this. I created repoA, repoB for repositories and workA and workB for working directories (checkouts).

Repositories

Z:\repos\repoA

Z:\repos\repoB

Working Directories

Z:\Projects\workA\trunk\core.php

Z:\Projects\workA\trunk\lib\lib01.php

Z:\Projects\workB\trunk\core_mod.php

Z:\Projects\workB\trunk\lib\

(there are tags and branches folders but they are omitted to keep the question simple.)

What I'd like to achieve is the file(s) under workA\trunk\lib\ in this case lib01.php to be automatically copied into the workB\trunk\lib\ directory.

In order to set this up, what I've done is as follows:

  1. Checked out workA and assigned it to repoA and checked out workB and assigned it to repoB
  2. Comitted the workA\trunk folder so the repoA is up to date.
  3. In oreder to assign an import location for workB\trunk\lib, right clicked on the workB folder and chose TortoiseSVN -> Properties.
  4. Clicked on New -> Externals and clicked New...
  5. typed ./trunk/lib in the Local path form field. For the URL field, typed file:///Z:/repos/repoA/trunk/lib. By pressing the ... button, repo-browser opened and helped to select the target folder.

  6. Clicked Ok a few times to close the settings windows. I assumed the externals setting was done.

  7. Created a file, Z:\Projects\workB\trunk\core_mod.php
  8. Right clicked on Z:\Projects\workB\trunk\ and selected SVN Comit to comit the workB to repoB.

I expected at this point, the lib01.php would be automatically imported in the Z:\Projects\workB\trunk\lib folder but nothing is copied. I also tried SVN Update by right clicking on the workB\trunk folder. But the workB\trunk\lib folder kept empty.

I suspect the relative path ./trunk/lib must be mistaken. I don't know. If you can point out what I'm doing wrong, it would be appreciated.

Update

6a - commit changed Working Copy WorkB to repo

This was a blind spot for me. I right clicked on Z:\Projects\workB and selected SVN Commit... and it gave the following error.

After clicking the OK button immediately I got a dialog window asking whether to update the folder and I clicked OK. Then TortoiseSVN started updating Z:\Projects\workB and I got this error. But after this, when I re-commited Z:\Projects\workB, it went through without an error.

("trunk/lib" in your case will be more bulletproof, I suppose).

Thanks, when I reselected Property of the workB folder and clicked on the Edit button for the svn:externals, TortoiseSVN automatically adjusted ./trunk/lib to trunk/lib. Now it is set to be so.

6b - test with repobrowser on RepoB (just fastest way), that definition is correct

I right clicked on Z:\repos\repoB and chose TortoiseSVN -> repo-browser and browsed down to the trunk folder. It looks as follows. Does it look right? I really don't know since I never had worked on this task. The lib folder under the trunk folder is empty in the repo-browser.

The Z:\Projects\workB\trunk\lib folder is still empty. The error message suggests to relocate 'Z:\Projects\workB' but I'm not sure what it means.


回答1:


You forgot at least one mandatory action

6a - commit changed Working Copy WorkB to repo

and one optional checkpoint

6b - test with repobrowser on RepoB (just fastest way), that definition is correct

Can't recall why, but I never use ./ in path-spec for URLs in TSVN ("trunk/lib" in your case will be more bulletproof, I suppose). And pure personal habits - I define external at the point of mount, even if as result I get multiple definitions inside repo instead one aggregated in root

Repo-browser with external in tree and definition shown




回答2:


For anybody who comes across this issue, the working directory of workB did not need the importing folder.

Z:\Projects\workA\trunk\core.php

Z:\Projects\workA\trunk\lib\lib01.php

Z:\Projects\workB\trunk\core_mod.php

Z:\Projects\workB\trunk\lib\

had to be

Z:\Projects\workA\trunk\core.php

Z:\Projects\workA\trunk\lib\lib01.php

Z:\Projects\workB\trunk\core_mod.php

Z:\Projects\workB\trunk\

( no Z:\Projects\workB\trunk\lib)



来源:https://stackoverflow.com/questions/12861082/setting-up-svnexternals-with-tortoisesvn-in-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!