I have checked out a file from CVS repository and changed it.
cvs up
command says that the file is modified M
.
I need to delete my changes. What cvs command can do it for me?
cvs export the 'old version' by tag (or you could do it by date) into a new folder. ensure the 'current version' is checked out, updated, and live. copy the files from the old version into the folder with the current version. commit the result with a suitable comment.
If you notice that you accidentally removed a file you need (before you run cvs commit ), you can use cvs add to undo the removal and then use cvs update to retrieve the removed file. This process leaves no record in the repository.
cvs add Add new files to an existing directory under CVS control. The cvs add command tells CVS to add the given file to its list of files that should be tracked in the working directory. The file is not created in the repository until you CVS commit the file or the directory it's in.
You use
cvs update -C filename
It's a surprisingly complicated to do. We ended up using this script "cvsunedit". Which I admit looks like overkill, but there are things in cvs that are just harder to do than they should be.
#!/bin/bash # cvsunedit - revert a file's modifications while preserving its current version set -e if [ "$1" = "" ] then exit 0 fi for f in $* do echo "$f" base="$(basename "$f")" dir="$(dirname "$f")" rev="$(perl -e "while(<>){m#/$base/([^/]+)/# && print \$1 . \"\n\";}" < "$dir/CVS/Entries")" if [ "$rev" = "" ] then echo "Cannot find revision for $f in $dir/CVS/Entries" exit 1 fi executable=0 [ -x "$f" ] && executable=1 mv "$f" "$f.$$.rev$rev.bak" || rm -f "$f" set -x cvs up -p -r "$rev" "$f" > "$f" set +x chmod -w "$f" [ $executable -ne 0 ] && chmod aog+x "$f" done exit 0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With