Import files directly to SVN repo without checking

2020-07-13 06:43发布

I am using SVN and have a repository on a remote machine. Sometimes, when working on my local machine I realize that I need to add some new files to the repo. The usual procedure I know would then be:

  1. at the current folder on my local machine checkout the whole SVN repo
  2. enter there
  3. copy the interesting file here
  4. commit

But this can be a bit tedious. I wonder if somehow, I can omit steps 1 to 3 and import the "interesting" file to SVN directly without necessity of checking out the repo first?

标签: svn bash
3条回答
淡お忘
2楼-- · 2020-07-13 07:04

Perhaps svn import is what you want ? Check the documentation for details.

查看更多
对你真心纯属浪费
3楼-- · 2020-07-13 07:05

You can checkout only the folder where the new files go, add the new files and commit.

Seems to me like what you're doing is dangerous. If you don't update from SVN first and re-compile the code, you might be introducing bugs or break the build. Maybe the interface of that class you're using has changed in the repository!

查看更多
Juvenile、少年°
4楼-- · 2020-07-13 07:22

Following worked beautifully for me:

  1. Log into Linux machine with the user containing access to the svn repository.
  2. Create a new directory e.g. "cwo_tracking" that needs to be added in svn
  3. Now just ensure the svn tool is installed and has "import" option in it. Run

    svn import --help

  4. Now check the complete HTTPS URL of the SVN directory under which you want to add the new file/folder e.g. https://SVN_HOST/REPO/PROJECTS/PARENT. For us it is PARENT which should have "cwo_tracking" folder added after we are done checking in.

  5. In your present working directory containing "cwo_tracking" named empty folder, run

    svn import cwo_tracking https://SVN_HOST/REPO/PROJECTS/PARENT/cwo_tracking

  6. This should open a editor to enter comment. Put a relevant comment e.g. "Adding new dir for cwo tracking project", save and exit.

  7. Once you save the comment it might ask you for password. If it does, Enter that and If it asks you to save your Password, type no.

  8. It should show something like -

    Committed revision 735.

  9. Now open a Web Browser and go to the URL you typed into the import command

    https://SVN_HOST/REPO/PROJECTS/PARENT/cwo_tracking

That should open a page. This is the one you added!

查看更多
登录 后发表回答