How to ignore .*o*.cmd on a local linux repository? - linux

I would like to ignore all files like .sddr09.o.cmd or .karma.o.cmd etc onto a kernel svn repository.
I try somme commands like :
svn propset svn:ignore '*.cmd' . --recursive
or
svn propset svn:ignore '*.o.cmd' . --recursive
or
svn propset svn:ignore '.*.o.cmd' . --recursive
but no one success to prevent from commit these files.
So I try to use the dontdiff file located in linux/Documentation/dontdiff appending
*.cmd
*.o.cmd
.*.o.cmd
at the end of the file
and I use the following command line :
svn propset svn:ignore -R -F Documentation/dontdiff .
but no more success.
Any Idea ?

You mention in the comments that you've already added these files, so the first step is to undo that. Presumably you used svn add to add the files, so you'll need to use the inverse of that: svn delete.
svn delete --keep-local path/to/file
The --keep-local will tell SVN not to undo any modifications you've made. If you do want to reset the files to their original state (or delete them if they didn't exist before), you can omit the option.
You can confirm this with svn status. The files in question should not have anything in the first column.
After that, you should be able to run the svn ignore commands that you included in your question.

Related

Git delete all unmodified files

I am using git in my project at Linux platform. I have plenty of files in a particular directory. I modified some 50 above files in that directory and didn't stage and commit it. I wish to delete all other unmodified files from that directory? Is there a way to do this, using git and Linux Commands?
Not sure why you would want to do this.... but you can:
# Save changes to stash
git stash save
# Remove everything left
rm -rf ./*
# Checkout (restore) all of the changed files
git stash show --stat | grep -v changed | sed -e 's/|.*$//;' | xargs git checkout
# Restore the changes to those files
git stash pop
git reset --hard [HEAD] should work for you repeated
Repeated question How can I discard modified files?
You can also use more simple commands for this purpose:
git clean -Xfd // capital X
git clean -xfd // lower x
It will clean your working directory from the desired files.
Using git clean is what you want. To remove (-x) those files and directories (-d), run:
$ git clean -fdx
If you use the -X option instead of -x, then the files you have told git to ignore will still be kept (e.g., build artifacts). Recent versions of git require either "-f" (force) or "-n" (dry-run) to be specified.
You should run a dry-run first, to show what will happen, but not actually do anything:
$ git clean -ndx
I use this so often, that I have an alias for this (added to your .gitconfig) to check for files that would be deleted when you run git clean. It's also useful to remind me if I've forgotten to "git add" a file that I want to keep.
[alias]
# list files that would be removed via 'clean' (non-destructive)
ifc = clean -ndx
Then, running git ifc (i.e,. "ifc" = "if clean") shows everything that isn't tracked and could be removed, or isn't tracked and should be added.
https://git-scm.com/docs/git-clean

SVN: undo a merge with local changes

I was on version 100, with local changes.
I did an svn up to reach HEAD (which is revision 200). Then I was ill adviced to revert back to revision 150, with my local changes, in command: svn merge -r HEAD:150 .
Now I actually want to go back to revision 200 with my local changes. svn up doesn't do anything, because I appear to still have file missings. I know because a file A.cpp was in revision 200 but not in my local working copy.
If I do svn status, I see a bizzare "D" in front of A.cpp. they seem to think I want to delete this file I don't even own.
What state am I in now, and how do I fix it?
In brief, your current checked out repo is messed up - it has a combination of your changes as well as a set of uncommitted changes to go back from HEAD -> r150. If you committed at this point, it would have the effect of removing all the changes that happened from 150:HEAD, and then adding in your changes.
If trying to do a re-merge: svn merge -r 150:HEAD . doesn't work (and generally it won't), then I would suggest the following:
assuming you have your current workspace <currws>
checkout a second copy of the workspace, at revision 150: svn co -r 150 <svn url> <newws>. This will give you a directory <newws>
(cd <currws>; tar cf - --exclude .svn .) | (cd <newws>; tar xf -). This will take all the files & directories from <currws> and copy them into <newws>.
Take inventory of the new directory - it should now contain copies of only your changes - some of these may need to be SVN added to the workspace; or if you have deletes, they will need to be re-deleted on the <newws>. You can pre-remove all the files/folders from new-ws prior to the tar, and anything that appears after the tar with a ! indicates a file that you removed with your changes, anything with a ? is a file that needs adding, and the remainder should be M entries.
Bring the new workspace up to HEAD - svn up <newws> should work in this case.
verify that everything's working and that it only contains your changes.
make a patch file, get it code reviewed and then commit it.
I'm pretty sure this will get you back on-track; although I don't have a tree to check against with the spotty network connectivity I have.

Deleting a folder from svn repository

I sometimes make mistakes with svn and have folders stuck in my repository. I want to remove these folders but I cannot figure out a way to do this. Keep in mind I am very new with SVN. I am running this command from apple terminal:
sudo svn delete http://www.yourrepository.com/svn/folder
I get the message :
Anthony-Work-Mac-Pro:htdocs APN$ sudo svn delete http://www.yourrepository.com/svn/folder
svn: Could not use external editor to fetch log message; consider setting the $SVN_EDITOR environment variable or using the --message (-m) or --file (-F) options
I have also tried svn delete, and svn rm.
What do I need to do?
Looks like a commit message is required, and you do not have your system configured to launch an editor for you to add one (without specifying on the command line).
Try this:
svn delete http://www.yourrepository.com/svn/folder --message "Deleting"
To avoid similar messages in the future, add something like export SVN_EDITOR="/usr/bin/vim" to your .bash_profile (or something similar for your Mac :))
You can use 2 step delete and commit for this as well. No need to use repository URL.
svn delete filename1 filename2 forldername1
svn commit -m "[Message] Unwanted files and folder."
I use powershell and the command svn list -R to search the repo recursively for folders I want to delete and then pipe the results into findstr or similar, like:
svn list -r HEAD -R | findstr /R /I "\/obj\$/ \/bin\/$" | % { svn delete --force $_ }
This uses regular expressions to search. Each /folder/ you want to find in the repo is separated by a blankspace, not the usual | (bar) character used in regular expresions.
Good idea to try it out first with just:
svn list -r HEAD -R | findstr /R /I "\/obj\$/ \/bin\/$"
Note to be absolutely sure what you are doing before commit.

ignoring a file in svn?

Im using command and just tried the following:
svn propset svn:ignore "conf.php"
However this opens up vim and if I exit the file svn-prop.tmp file is created.
I don't want to delete it as I need it, but I would love it if svn could just not list it when i svn st
What when wrong (conf.php is still listed when I svn st) and how do I correct it?
If conf.php has already been committed, then there are no ignore patterns you can throw at Subversion to get it to ignore the file.
What you probably want to do is:
svn mv conf.php conf.php.template. This will move conf.php to conf.php.template.
svn commit.
cp conf.php.template conf.php.
Assuming that you have already set the svn:ignore property, then this should do it. At this point, you will have a versioned conf.php.template file that you can modify when you want the configuration stored in the repository to change, and you have an unversioned conf.php that you can tweak locally without Subversion informing you that it needs to be committed.
If you check out the repository elsewhere, just make sure that you cp conf.php.template conf.php to set up the initial configuration; then you can tweak conf.php as needed.
you need to set the ignore property on the directory containing the file you want to ignore:
svn propedit svn:ignore .
then enter the filename(s) to ignore when your editor comes up

tortoisesvn lost history of file due to delete, then add of same file

I had a developer 'revert' a file by deleting it from the repository and re-adding it. We now have a current file with no history. Is there a way to get back the deleted file. With it having the same name as existing file, how should I proceed? Yes, I have tried to read the docs but can't seem to get the right combination of actions to take.
delete the file in your working copy
in the repository browser, go to the revision where the original file still existed (i.e. before it was replaced)
right-click on that file in that revision in the repository browser, execute "copy to working copy"
specify the path in your working copy as the "copy to"-target
Now you have your file back including the history.
see this thread here...
examining history of deleted file
to resurrect your file you can
svn copy url/of/file#lastrevisionthefileexisted -r lastrevisionthefileexisted path/to/workingcopy/file
On Linux, I solved the problem by following the steps on the command line:
svnadmin create TEST
svn co https://URL/svn/codes/JarLib/
Delete file or directory which is re-added
svn delete https://URL/svn/codes/JarLib/XXXX.jar -m "XXXX.jar history resurrect operation"
svn update
Use 'svn copy' command to get deleted file/directory with HISTORY. Revision number must be deleted file's/directory's last revision number!!!
svn copy https://URL/svn/codes/JarLib/XXXX.jar#22467 -r 22467 XXX.jar
Operation below will add XXXX.jar to your Working Copy then commit the changes.
svn commit -m "deleted file/directory is resurrected"
To control:
Go to SVN Server and use svnlook command like:
svnlook history /svn/repos/codes /JarLib/XXXX.jar --show-ids

Resources