Svn checkout # in path - batch-file

I've got the strange behavior in svn checkout for checkout folder with # char in folder name
If I do
svn.exe checkout "file:///d:/test/test_repo" "D:\test\#path"
then I got checkout in D:\test#path folder, not in D:\test\#path
Why?
Doc say about special # meaning in URL[#REV] part, not in path part.
Update
Simple
md "D:\test\#path"
creates the D:\test\#pathfilder, so # is not batch-special macro.
Update - 2
svn.exe" checkout "file:///d:/test/test_repo" "D:\test\\#path" - same result.
I use svn v1.8

Related

How to add multiple files from multiple directories into svn changelist?

I want to add and commit files which are present in different directories using changelist. I have written code in .bat file, you can find the example code below
svn add dem.txt
cd demo/docu
svn add dem.py
svn changelist mychangelist dem.py ../../dem.txt
i am checking the files which are present in the changelist by
svn st --changelist mychangelist
it gives
--- Changelist 'mychangelist':
A dem.py
but it is not showing dem.txt in the mychangelist.
Process i followed is it correct or any other problems in mycode?
Type:
cd ..\..
Then try again:
svn status --changelist mychangelist
The output will be something like:
--- Changelist 'mychangelist':
A dem.txt
A demo/docu/dem.py
The svn status command looks in the current directory and its sub-directories, but not in higher directory levels. The command svn status --changelist does not look for the given changelist and displays the contained items, rather it looks for items in the current directory tree and displays those that are listed in the given changelist. If you think like that you understand why the command behaves like this.
To prove this, try this (after having done the above mentioned cd command line):
svn status --non-recursive --changelist mychangelist
Which will produce the following output:
--- Changelist 'mychangelist':
A dem.txt

SVN Rename file as a directory

I need to use the name of a particular file as a directory name, and that file to be moved inside brand new directory.
My repo look like this right now:
file1
file2
dir1/
dir1file1
search
source_code2
And I need to get this:
file1
file2
dir1/
dir1file1
search/
search_contents
source_code2
The operations that I need to do are:
mv search search_contents
rm search
mkdir search
mv search_contents search/
I suppose that I can do:
svn move search search_contents
svn del search
mkdir search
svn add search
svn move search_contents search/
Does it make sense?
How svn will deal with several commands over a single file name? (without doing a commit) Or should I make intermediate commits?
If you try to do that without committing and updating in-between, you'll get a message like this:
svn: Can't replace 'search' with a node of a differing type; the
deletion must be committed and the parent updated before adding
'search'
Just change your list of svn commands to this:
svn move search search_contents
svn commit -m "Renamed file"
svn up
mkdir search
svn add search
svn mv search_contents search
svn commit -m "done"
It turned out that those steps can be done in one single commit:
# variant 1
svn move search search-newname
mkdir search
svn add search
svn move search-newname search/search
svn commit -m "magic"
# variant 2
svn delete search
mkdir search
svn add search
svn copy "^/search#3" search/
svn commit -m "more magic"
Thing is that I wasn't sure and I didn't want to mess up the repo, the credits to this answer go for tacit on #svn channel on irc.freenode.net
Also, I have to thank to danilsh and wayita for mention svnmucc. svnmucc is a tool that can combine several comands in a list (cp, mv, rm, etc.)

tried to add a new update.secondary hook to my repos in gitolite and now git push fails

remote: Undefined subroutine &main::repo_rights called at hooks/update line 41.
remote: error: hook declined to update
I have removed the update hook from all of my repos in order to get around this, but I know that they are now wide open.
I ran gl-setup, and I may have mixed versions of gitolite on my machine. I am afraid that I ran the gl-setup from a version that is different than the one I am running currently. I am not sure how to tell. Please help. :-(
Update, for a more recent version of Gitolite (namely a V3.x or more), the official documentation would be: "adding your own update hooks", and it uses VREFs (virtual refs).
add this line in the rc file, within the %RC block, if it's not already present, or uncomment it if it's already present and commented out:
LOCAL_CODE => "$ENV{HOME}/local",
copy your update hook to a subdirectory called VREF under this directory, giving it a suitable name (let's say "crlf"):
# log on to gitolite hosting user on the server, then:
cd $HOME
mkdir -p local/VREF
cp your-crlf-update-hook local/VREF/crlf
chmod +x local/VREF/crlf
in your gitolite-admin clone, edit conf/gitolite.conf and add lines like this:
- VREF/crlf = #all
to each repo that should have that "update" hook.
Alternatively, you can simply add this at the end of the gitolite.conf file:
repo #all
- VREF/crlf = #all
Either way, add/commit/push the change to the gitolite-admin repo.

How to create patch for a new file?

I know to create a patch for an existing file is easy:
diff -aru oldFile newFile 2>&1 | tee myPatch.patch
But what to do, if i want to create a patch for a totally new file? Assume my file is residing in a folder called TestDir. Earlier TestDir did not have a file called entirelyNewfile.c, but now it is having the same.
How to create a patch for entirelyNewfile.c? The idea is, the patch should get properly applied to the specs and generate the RPM build. With BUILD dir having this new file.
Just to add: if i try to take diff between the two directories, one having the new file and the other missing the same, to create the patch, it generates an error saying that file is only present in one folder
Add -N to the diff arguments.
diff /dev/null <newfile>
Will create a patch for your newfile.
The easiest way to do this that I know is to put all the files under version control (if they aren't already). I prefer Git, but something similar could be done in any other version control system:
git init
git add .
git commit -m "initial state"
<do your edits here>
git add .
git commit -m "new state"
git diff HEAD^1

Mercurial, stop versioning cache directory but keep directory

I have a CakePHP project under Mercurial version control. Right now all the files in the app/tmp directory are being versioned, which are always changing.
I do not want to version control these files.
I know I can stop by running hg forget app/tmp/*
But this will also forget the file structure. Which I want to keep.
Now I know that Mercurial doesn't version directories, just files, but the CakePHP folks were also smart enough to put an empty file called empty in every empty directory (I am guessing for this reason).
So what I want to do is tell Mercurial to forget every file under app/tmp except files whos name is exactly empty.
What would the command be for this?
Well, if nothing else works, you can always just ask Mercurial to forget everything, and then revert empty before committing:
Here's how I reproduced it, first create initial repo:
hg init
md app
md app\tmp
echo a>app\empty
echo a>app\tmp\empty
hg commit -m "initial" -A
Then add some files we later want to get rid of:
echo a >app\tmp\test1.txt
echo a >app\tmp\test2.txt
hg commit -m "adding" -A
Then forget the files we don't want:
hg forget app\tmp\*
hg status <-- will show all 3 files
hg revert app\tmp\empty
hg status <-- now empty is gone
echo glob:app/tmp>.hgignore
hg commit -m "ignored" -A
Note that all .hgignore does is to prevent Mercurial from discovering new files during addremove or commit -A, if you have explicitly tracked files that match your ignore filter, Mercurial will still track changes to those files.
In other words, even though I asked Mercurial to ignore app/tmp above, the file empty inside will not be ignored, or removed, since I have explicitly asked Mercurial to track it.
At least theoretically (I don't have time to try it right now), pattern matching should work with the hg forget command. So, you could do something like hg forget -X empty while in the directory (-X means "exclude").
You may want to consider using .hgignore, of course.
Since you only need to do it once I'd just do this:
find app/tmp -type f | grep -v empty | xargs hg forget
hg commit
from then on just put this in your `.hgignore'
^app/tmp
Mercurial has built-in support for globbing and regexes, as explained in the relevant chapter in the mercurial book. The python regex implementation is used.
This should work for you:
hg forget "re:app/tmp/.*(?<!/empty)$"

Resources