1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-26 04:00:59 +01:00

Files and directorys are now properly 'svn deleted'

This commit is contained in:
Wouter den Breejen 2007-07-13 11:48:57 +00:00
parent e33a1e4e74
commit 6392da5f90
2 changed files with 60 additions and 16 deletions

View file

@ -42,6 +42,8 @@ function subversionSingleStateDir {
excludelist=( "." ".." ".svn" ); excludelist=( "." ".." ".svn" );
checkForSVNDelete $1; #check for deleted files/folders (TODO does this also need to be here ???)
cd $1; cd $1;
#echo cd $1; #echo cd $1;
@ -56,7 +58,7 @@ function subversionSingleStateDir {
for subitem in ${allsubitems[@]} for subitem in ${allsubitems[@]}
do do
if [ "$subitem" = ".svn" ]; then if [ "$subitem" = ".svn" ]; then
allsubitems=( $(svn -N stat | sed -n '/^?/p' | sed 's/? //' | tr -d "\12") ) #there are subfiles, and theyre already versioned allsubitems=( $($svnbin -N stat | sed -n '/^?/p' | sed 's/? //' | tr -d "\12") ) #there are subfiles, and theyre already versioned
if [ "$deletesvn" = "1" ]; then if [ "$deletesvn" = "1" ]; then
rm -rf .svn/ rm -rf .svn/
@ -113,25 +115,41 @@ function subversionSingleStateDir {
do do
if test -d $item; then #add or go recursive subitems if test -d $item; then #add or go recursive subitems
if [ "$deletesvn" != "1" ]; then if [ "$deletesvn" != "1" ]; then
$debug svn -N add $item #NON recursively add the dir $debug $svnbin -N add $item #NON recursively add the dir
fi fi
subversionSingleStateDir $item subversionSingleStateDir $item
else else
if [ "$deletesvn" != "1" ]; then if [ "$deletesvn" != "1" ]; then
$debug svn add $item $debug $svnbin add $item
fi fi
fi fi
done done
} }
#
# Takes a dir or file, checks for deleted files / folders and svn delete's them
#
function checkForSVNDelete {
#echo checking for deleted items: $1;
allsubitems=( $($svnbin -N stat $1 | sed -n '/^!/p' | sed 's/! //' | tr -d "\12") ) #select all deleted files
#echo "All deleted subitems ${allsubitems[@]}"
for subitem in ${allsubitems[@]} #then svn delete them
do
$debug $svnbin delete $subitem
done
}
# #
# #
# #
# #
if ! test -d "${statepath}/.svn/"; then #if the dir exists but is not yet an svn dir: checkout repos, if it doenst exits (is removed or something) than we dont do anything if ! test -d "${statepath}/.svn/"; then #if the root dir exists but is not yet an svn dir: checkout repos, if it doenst exits (is removed or something) than we dont do anything
if [ "$deletesvn" != "1" ]; then if [ "$deletesvn" != "1" ]; then #TODO !!!!!!!!!!!!!!! we shouldnt checkout !!!!!!!!!!!!!!!!!
$debug $checkout; $debug $checkout;
fi fi
fi fi
@ -139,6 +157,9 @@ fi
i=0 i=0
for path in ${subversionedpaths[@]} for path in ${subversionedpaths[@]}
do do
checkForSVNDelete $path; #check if path or file is deleted
if test -d $path; then #if the dir doesnt exist, than we dont hav to do anything if test -d $path; then #if the dir doesnt exist, than we dont hav to do anything
cd $path; cd $path;
@ -147,7 +168,7 @@ do
if ! test -d "${path}/.svn/"; then #Dir: Also add yourself if nessecary if ! test -d "${path}/.svn/"; then #Dir: Also add yourself if nessecary
if [ "$deletesvn" != "1" ]; then if [ "$deletesvn" != "1" ]; then
$debug svn -N add $path $debug $svnbin -N add $path
fi fi
fi fi
@ -165,7 +186,7 @@ do
alreadyversioned=$(svn -N stat $path ) alreadyversioned=$(svn -N stat $path )
if [ "$alreadyversioned" != "" ]; then if [ "$alreadyversioned" != "" ]; then
echo "Subversioning $path" echo "Subversioning $path"
$debug svn add $path $debug $svnbin add $path
fi fi
fi fi
fi fi
@ -174,6 +195,7 @@ done
cd $statepath #now that everything is added we go back to the 'root' path and commit cd $statepath #now that everything is added we go back to the 'root' path and commit
if [ "$deletesvn" != "1" ]; then if [ "$deletesvn" != "1" ]; then
$debug svn -m "" commit; $debug $svnbin -m "" commit;
$debug $svnbin up "" commit; #do a svn up to update the local revision number ... (the contents stays the same)
fi fi

View file

@ -42,6 +42,8 @@ function subversionSingleStateDir {
excludelist=( "." ".." ".svn" ); excludelist=( "." ".." ".svn" );
checkForSVNDelete $1; #check for deleted files/folders (TODO does this also need to be here ???)
cd $1; cd $1;
#echo cd $1; #echo cd $1;
@ -56,7 +58,7 @@ function subversionSingleStateDir {
for subitem in ${allsubitems[@]} for subitem in ${allsubitems[@]}
do do
if [ "$subitem" = ".svn" ]; then if [ "$subitem" = ".svn" ]; then
allsubitems=( $(svn -N stat | sed -n '/^?/p' | sed 's/? //' | tr -d "\12") ) #there are subfiles, and theyre already versioned allsubitems=( $($svnbin -N stat | sed -n '/^?/p' | sed 's/? //' | tr -d "\12") ) #there are subfiles, and theyre already versioned
if [ "$deletesvn" = "1" ]; then if [ "$deletesvn" = "1" ]; then
rm -rf .svn/ rm -rf .svn/
@ -113,25 +115,41 @@ function subversionSingleStateDir {
do do
if test -d $item; then #add or go recursive subitems if test -d $item; then #add or go recursive subitems
if [ "$deletesvn" != "1" ]; then if [ "$deletesvn" != "1" ]; then
$debug svn -N add $item #NON recursively add the dir $debug $svnbin -N add $item #NON recursively add the dir
fi fi
subversionSingleStateDir $item subversionSingleStateDir $item
else else
if [ "$deletesvn" != "1" ]; then if [ "$deletesvn" != "1" ]; then
$debug svn add $item $debug $svnbin add $item
fi fi
fi fi
done done
} }
#
# Takes a dir or file, checks for deleted files / folders and svn delete's them
#
function checkForSVNDelete {
#echo checking for deleted items: $1;
allsubitems=( $($svnbin -N stat $1 | sed -n '/^!/p' | sed 's/! //' | tr -d "\12") ) #select all deleted files
#echo "All deleted subitems ${allsubitems[@]}"
for subitem in ${allsubitems[@]} #then svn delete them
do
$debug $svnbin delete $subitem
done
}
# #
# #
# #
# #
if ! test -d "${statepath}/.svn/"; then #if the dir exists but is not yet an svn dir: checkout repos, if it doenst exits (is removed or something) than we dont do anything if ! test -d "${statepath}/.svn/"; then #if the root dir exists but is not yet an svn dir: checkout repos, if it doenst exits (is removed or something) than we dont do anything
if [ "$deletesvn" != "1" ]; then if [ "$deletesvn" != "1" ]; then #TODO !!!!!!!!!!!!!!! we shouldnt checkout !!!!!!!!!!!!!!!!!
$debug $checkout; $debug $checkout;
fi fi
fi fi
@ -139,6 +157,9 @@ fi
i=0 i=0
for path in ${subversionedpaths[@]} for path in ${subversionedpaths[@]}
do do
checkForSVNDelete $path; #check if path or file is deleted
if test -d $path; then #if the dir doesnt exist, than we dont hav to do anything if test -d $path; then #if the dir doesnt exist, than we dont hav to do anything
cd $path; cd $path;
@ -147,7 +168,7 @@ do
if ! test -d "${path}/.svn/"; then #Dir: Also add yourself if nessecary if ! test -d "${path}/.svn/"; then #Dir: Also add yourself if nessecary
if [ "$deletesvn" != "1" ]; then if [ "$deletesvn" != "1" ]; then
$debug svn -N add $path $debug $svnbin -N add $path
fi fi
fi fi
@ -165,7 +186,7 @@ do
alreadyversioned=$(svn -N stat $path ) alreadyversioned=$(svn -N stat $path )
if [ "$alreadyversioned" != "" ]; then if [ "$alreadyversioned" != "" ]; then
echo "Subversioning $path" echo "Subversioning $path"
$debug svn add $path $debug $svnbin add $path
fi fi
fi fi
fi fi
@ -174,6 +195,7 @@ done
cd $statepath #now that everything is added we go back to the 'root' path and commit cd $statepath #now that everything is added we go back to the 'root' path and commit
if [ "$deletesvn" != "1" ]; then if [ "$deletesvn" != "1" ]; then
$debug svn -m "" commit; $debug $svnbin -m "" commit;
$debug $svnbin up "" commit; #do a svn up to update the local revision number ... (the contents stays the same)
fi fi