Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN Import Force for importing existing file

Tags:

svn

I am creating a text file and a ZIP file for a tag automatically with MSBuild. My MSBuild project is called by CruiseControl.NET.

The text file is always going to be latest.txt and the ZIP file will be (version).zip (so it will be different every time). I do not want to commit these files back to my trunk nor check out the tags directory.

Hence, I discovered svn import. The first time it works for both. On successive runs, it fails since latest.txt already exists in the repository. Do I need to use svn import --force or something else to get these two files pushed up to my repository?

like image 332
Daniel A. White Avatar asked Jan 19 '26 10:01

Daniel A. White


2 Answers

Based on the comments, the answer to the question would be to only svn import the (version).zip file. Since the contents of latest.txt change for each build, it is a versioned file and should be committed as such.

like image 86
Kevin Crowell Avatar answered Jan 23 '26 19:01

Kevin Crowell


svn import allows you to commit an unversioned file into the repository. If it is a new file on the repo, it works fine. But you cannot use svn import to commit to an existing path.

The workaround then would be to delete the repo file first, and then import it back again.

  • Delete command: svn delete URL -m "deleting for update"
  • Import command: svn import PATH URL -m "<your message here>"

You will lose the file history, but it's a nice way of making straightforward updates to simple files; and since you don't care about versioning, it should suit your needs.

like image 22
luizfls Avatar answered Jan 23 '26 20:01

luizfls