Skip to content

Commit 1bc899c

Browse files
author
Jared Murrell
authored
small fixes and comments
1 parent e46c50e commit 1bc899c

1 file changed

Lines changed: 34 additions & 36 deletions

File tree

_functions.sh

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ login ${SVN_USERNAME}
5050
password ${SVN_PASSWORD}
5151
EOF
5252
## Set our default SVN options
53-
SVN_OPTIONS="--trust-server-cert --non-interactive --no-auth-cache"
53+
SVN_OPTIONS="--trust-server-cert --non-interactive --no-auth-cache --username ${SVN_USERNAME} --password ${SVN_PASSWORD}"
5454
## Get the repo name and full URL for the remote subversion repository
5555
REPO_NAME=$(svn info ${REPOSITORY} ${SVN_OPTIONS}|grep '^Path'|awk {'print $2'}|sed 's/ /-/g')
5656
REPO_URL=$(svn info ${REPOSITORY} ${SVN_OPTIONS}|grep '^URL'|awk {'print $2'})
@@ -123,6 +123,7 @@ function _print_banner()
123123
tput sgr 0
124124
}
125125

126+
## Print our welcome message
126127
function _welcome()
127128
{
128129
clear
@@ -267,6 +268,7 @@ function _discover_submodules()
267268
fi
268269
}
269270

271+
## Discover what our repository looks like
270272
function _get_svn_layout()
271273
{
272274
unset FLAGS
@@ -299,6 +301,7 @@ function _get_svn_layout()
299301
fi
300302
}
301303

304+
## Convert our nested repositories to Git and push to GitHub
302305
function _process_submodules()
303306
{
304307
echo '' > /tmp/github_remotes.txt
@@ -322,20 +325,19 @@ function _process_submodules()
322325
done
323326
}
324327

325-
function _git_svn_clone_without_history()
328+
## Perform a clean cutover
329+
function _clean_cutover()
326330
{
327-
_print_banner "Cloning ${REPO_NAME} without history"
328-
_get_svn_layout
331+
_print_banner "Migrating ${REPO_NAME} without history"
332+
rm -fr ${REPO_NAME}
329333
git svn clone -rHEAD ${REPO_URL} ${REPO_NAME} ${FLAGS} --prefix=svn/
334+
cd ${REPO_NAME}
335+
_migrate_trunk
336+
_migrate_branches
337+
_migrate_tags
330338
}
331339

332-
function _git_svn_clone_with_history()
333-
{
334-
_print_banner "Cloning ${REPO_NAME} without history"
335-
_get_svn_layout
336-
git svn clone ${REPO_URL} ${REPO_NAME} ${FLAGS} --prefix=svn/
337-
}
338-
340+
## Migrate our repository with history
339341
function _git_svn_clone()
340342
{
341343
git svn init ${REPO_URL} ${REPO_NAME} ${FLAGS} --prefix=svn/
@@ -359,22 +361,13 @@ function _git_svn_clone()
359361
WRITE
360362
for REV in ${REV_LIST}
361363
do
362-
#[[ ${CURRENT_REV} -le 5 ]] && clear
363-
#HIDECURSOR
364-
#echo -e "" && echo -e ""
365-
#DRAW
366-
#echo -e " CLONING ${REPO_NAME^^}"
367-
#echo -e " lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"
368-
#echo -e " x x"
369-
#echo -e " mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj"
370-
#WRITE
371364
showBar ${CURRENT_REV} ${REV_COUNT}
372365
echo -e "" && echo -e " REV: ${REV}"
373366
git svn fetch -qr${REV} ${AUTHORS} &>> ${LOG_FILE} > /dev/null
374367
RESULT=$?
375368
while [[ ${RESULT} -ne 0 ]]
376369
do
377-
echo "" && echo "" && echo ""
370+
echo "" && echo ""
378371
echo "Revision ${REV} failed to clone, possibly due to corruption."
379372
echo ""
380373
ERROR_MSG=$(grep [a-zA-Z0-9] ${LOG_FILE}|tail -n1)
@@ -386,25 +379,25 @@ function _git_svn_clone()
386379
echo 'Please type "yes" or "no"'
387380
read -p "Would you like to attempt revision ${REV} again? (yes/no) " RETRY
388381
done
382+
clear
383+
HIDECURSOR
384+
echo -e "" && echo -e ""
385+
DRAW
386+
echo -e " CLONING ${REPO_NAME^^}"
387+
echo -e " lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"
388+
echo -e " x x"
389+
echo -e " mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj"
390+
WRITE
391+
OLD_REV=0
392+
while [[ ${OLD_REV} -lt ${CURRENT_REV} ]]
393+
do
394+
showBar ${OLD_REV} ${REV_COUNT}
395+
((OLD_REV++))
396+
done
389397
if [[ "${RETRY,,}" == "no" ]]
390398
then
391399
RESULT=0
392400
else
393-
clear
394-
HIDECURSOR
395-
echo -e "" && echo -e ""
396-
DRAW
397-
echo -e " CLONING ${REPO_NAME^^}"
398-
echo -e " lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"
399-
echo -e " x x"
400-
echo -e " mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj"
401-
WRITE
402-
OLD_REV=0
403-
while [[ ${OLD_REV} -lt ${CURRENT_REV} ]]
404-
do
405-
showBar ${OLD_REV} ${REV_COUNT}
406-
((OLD_REV++))
407-
done
408401
showBar ${CURRENT_REV} ${REV_COUNT}
409402
echo -e "" && echo -e " REV: ${REV}"
410403
git svn fetch -qr${REV} ${AUTHORS} &>> ${LOG_FILE} > /dev/null
@@ -419,6 +412,8 @@ function _git_svn_clone()
419412
)
420413
}
421414

415+
## Check to see if we have large binaries
416+
## If we do, initialize Git-LFS and track them
422417
function _initialize_lfs()
423418
{
424419
LARGE_FILES=$(find . -path ./.git -prune -o -size +10M -exec ls {} \+)
@@ -437,6 +432,8 @@ function _initialize_lfs()
437432
fi
438433
}
439434

435+
## Add the discovered Git Submodules to our
436+
## repository
440437
function _add_git_submodules()
441438
{
442439
(
@@ -474,6 +471,7 @@ function showBar()
474471
tput sgr0
475472
}
476473

474+
## Clean up the files that will break re-runs
477475
function _cleanup()
478476
{
479477
rm -f /tmp/{submodules,github_remotes}.txt

0 commit comments

Comments
 (0)