Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move/rename a file in Subversion with @ characters in it

From the SVN book:

The perceptive reader is probably wondering at this point whether the peg revision syntax causes problems for working copy paths or URLs that actually have at signs in them. After all, how does svn know whether news@11 is the name of a directory in my tree or just a syntax for “revision 11 of news”? Thankfully, while svn will always assume the latter, there is a trivial workaround. You need only append an at sign to the end of the path, such as news@11@. svn cares only about the last at sign in the argument, and it is not considered illegal to omit a literal peg revision specifier after that at sign. This workaround even applies to paths that end in an at sign—you would use filename@@ to talk about a file named filename@.


According to this description, you only need to add an @ sign to the path.

so this:

svn add "C:\SomeTests\[email protected]"

gives me that error:

svn: E200009: 'C:/SomeTests/[email protected]': a peg revision is not allowed here

and this:

svn add "C:\SomeTests\[email protected]@"

works for me.

also this works for me:

svn info "C:\SomeTests\[email protected]@"

more here: How to escape @ characters in Subversion managed file names?


Ok, fine. But when I want to rename or move a file with @-characters. It provides strange results:

with:

svn mv "C:\SomeTests\test.txt" "C:\SomeTests\[email protected]"

I get this filename:

C:\SomeTests\[email protected]

with:

svn mv "C:\SomeTests\test.txt" "C:\SomeTests\[email protected]@"

I get this filename:

[email protected]@

with:

svn mv "C:\SomeTests\test.txt" "C:\SomeTests\@myfile.txt"

I get this filename:

[email protected]

with:

svn mv "C:\SomeTests\test.txt" "C:\SomeTests\@myfile.txt@"

I get this filename:

@myfile.txt@

What should I do that it always works? no matter if the @ sign is in the beginning, in the middle or at the end?

(edit: at my present issue the characters are always at the beginning or in second place.)

like image 296
nulldevops Avatar asked Dec 05 '14 09:12

nulldevops


People also ask

How do I change a filename in svn?

Renaming a file. Normally you can just use SVN Rename on the context menu. This is analogous to the Move command described in the Moving or Copying a file recipe. It is almost as if you are doing two separate steps: an Add operation with the new name and a Delete operation of the old name.

How do I move files in svn without losing history?

If you right-drag the folder and use "SVN move versioned item(s) here", then you keep the history. Even the history of the files within the folder.

How do I move a file from one directory to another in svn?

Moving files and folders select the files or directories you want to move. right drag them to the new location inside the working copy. release the right mouse button. in the popup menu select Context Menu → SVN Move versioned files here.

How do I copy a folder from one directory to another in svn?

The easiest way to copy files and folders from within a working copy is to use the right drag menu. When you right drag a file or folder from one working copy to another, or even within the same folder, a context menu appears when you release the mouse.


1 Answers

I have tried everywhere to get some support. But now I have found my solution by trial and error.

Just run the command like this:

svn mv "C:\@File.txt@\" "C:\@NewFile.txt/"

Add a @ (At) and a \ (Backslash) to the source path. And add a / (Forwardslash) to the destination path.

It works for me in each option:

@File to NoAtFile
@File to New@File
@File to @NewFile
NoAtFile to New@File
NoAtFile to @NewFile
_@File to NoAtFile
_@File to New@File
_@File to @NewFile

I hope it saves you the trouble I had. :)

like image 159
nulldevops Avatar answered Oct 03 '22 06:10

nulldevops