My thinking is to follow a work flow like:
- Get working copy from VSS
- git init
- create a "vss_branch" branch
- branch a "dev" branch from master
- branch dev for each individual feature/bug
- on feature completion, rebase to clean up comments (if I have been naughty)
- merge into dev when features/bugs are ready
- test dev
- if all good merge dev into master
- Synchronize my master branch with VSS
- switch to vss_branch
- get working copy from Visual Source Safe
- commit into vss_branch with "ss history" as comment
- pull vss_branch onto master
- test master
Synchronise VSS with master
- "ss checkout" files I have changed (don't overwrite working copy)
- "ss checkin" files I have changed (adding git comment as label)
- pull master into dev
I have attempted to stick to our VSS workflow but be a little more robust with the separate VSS git branch which I never push to.
The bashrc helper might look something like this (partly tested)
<!-- language: lang-bash -->
alias initgitss=InitGitAndSourceSafeProject
alias sspull="ss checkout"
alias ssmaster=SynchSStoMaster
alias masterss=SynchMasterToSS
#create a git project from a VSS project
#and set everything up
InitGitAndSourceSafeProject()
{
if [ $# -eq 0 ]
then
echo "No arguments supplied, please supply the SS project name"
else
git init
#get all the SS sourcecode
echo "Switching to $1"
ss cp $1
echo Y | ss get $1 -W -R -Q -Y$SSNAME
git add .
git commit -m "Initial Source Safe Clone"
git checkout -b vss_branch
git checkout -b dev
SynchMasterToSS
fi
}
#gets the database version of a file
ssoverwrite()
{
#the -L option throws "invalid switch"
ss checkout . $1 -L- -Y$SSNAME
}
#replace Source-safe code with my master branch code
SynchSStoMaster()
{
BRANCH=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
#get weeks worth of git master comments as label
COMMENT=&(git log git log --since=1.weeks)
FILES=$( git diff --name-only master vss_branch)
echo $FILES
#we might have some work uncommitted (naughty)
git stash
echo "to master branch"
git checkout master
echo "overwrite our code with SourceSafe code"
echo Y | ss checkout . $FILES -GWR -Y$SSNAME
echo "our code back"
git reset --hard master
#check the file in with latest git comments but keep files as writeable
echo Y | ss checkin . $FILES -C $COMMENT -W -Y$SSNAME
#"unpop" all the things we just did to restore working tree
git checkout $BRANCH
git stash apply
}
#merge master with source safe code
SynchMasterToSS()
{
#figure out files I have changed
FILES=$( git diff --name-only master vss_branch)
BRANCH=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
echo "merge within the context of git we need to pull from a git branch"
#to simplyfy things lets just overwrite the contents of a "vss branch" and pull from that
git checkout vss_branch
echo "checkout all files from sourcesafe"
ss get . -W -R -Q -Y$SSNAME
NOW=$(date)
#grab the recent history for those files
SSFILEHISTORY=$(ss History . $FILES -#3)
SSHISTORY=$(ss History . -#3)
git commit -a -m "Source safe sync: $NOW \n &SSFILEHISTORY \n&SSHISTORY"
git checkout master
git merge vss_branch
git checkout $BRANCH
}
SSDiff()
{
ss Diff -Y$SSNAME
}
#push to master
pushss()
{
git push master
SynchMasterToSS
}
#pull diff files from master
pullss()
{
SynchSStoMaster
git pull master
}