@@ -17,7 +17,7 @@ usage_export()
1717{
1818 cat << \USAGE_export_EOF
1919gi export usage: git issue export provider user repo
20- -e Expand escape attribute sequences before exporting(see gi list -l)
20+ -e Expand escape attribute sequences before exporting (see gi list -l)
2121
2222Example: git issue export github torvalds linux
2323USAGE_export_EOF
@@ -157,7 +157,7 @@ usage_create_issue()
157157{
158158 cat << \USAGE_create_issue_EOF
159159gi create usage: git issue create id provider user repo
160- -e Expand escape attribute sequences before exporting(see gi list -l)
160+ -e Expand escape attribute sequences before exporting (see gi list -l)
161161-n Keep HTTP transaction files
162162-u num Update issue #num instead of creating a new one
163163
@@ -577,7 +577,7 @@ import_comments()
577577 csha=$( cat " $import_dir /$comment_id " )
578578 else
579579 name=$( jq -r " .[$i ].$juser " comments-body)
580- GIT_AUTHOR_DATE =$( jq -r " .[$i ].updated_at" comments-body) \
580+ GIT_EVENT_DATE =$( jq -r " .[$i ].updated_at" comments-body) \
581581 commit ' gi: Add comment' " gi comment mark $isha " \
582582 --author=" $name <$name @users.noreply.$provider .com>"
583583 csha=$( git rev-parse HEAD)
@@ -602,12 +602,12 @@ import_comments()
602602 name=$( jq -r " .[$i ].$juser " comments-body)
603603 if [ " $provider " = github ] ; then
604604 html_url=$( jq -r " .[$i ].html_url" comments-body)
605- GIT_AUTHOR_DATE =$( jq -r " .[$i ].updated_at" comments-body) \
605+ GIT_EVENT_DATE =$( jq -r " .[$i ].updated_at" comments-body) \
606606 commit ' gi: Import comment message' " gi comment message $isha $csha
607607Comment URL: $html_url " \
608608 --author=" $name <$name @users.noreply.github.com>"
609609 else
610- GIT_AUTHOR_DATE =$( jq -r " .[$i ].updated_at" comments-body) \
610+ GIT_EVENT_DATE =$( jq -r " .[$i ].updated_at" comments-body) \
611611 commit ' gi: Import comment message' " gi comment message $isha $csha " \
612612 --author=" $name <$name @users.noreply.gitlab.com>"
613613 fi
@@ -665,7 +665,7 @@ import_issues()
665665 sha=$( cat " $import_dir /sha" )
666666 else
667667 name=$( jq -r " .[$i ].$juser " issue-body)
668- GIT_AUTHOR_DATE =$( jq -r " .[$i ].updated_at" issue-body) \
668+ GIT_EVENT_DATE =$( jq -r " .[$i ].updated_at" issue-body) \
669669 commit ' gi: Add issue' ' gi new mark' \
670670 --author=" $name <$name @users.noreply.$provider .com>"
671671 sha=$( git rev-parse HEAD)
@@ -776,7 +776,7 @@ import_issues()
776776 git add " $path /description" " $path /tags" imports || trans_abort
777777 if ! git diff --quiet HEAD ; then
778778 name=${name:- $(jq -r " .[$i ].$juser " issue-body)}
779- GIT_AUTHOR_DATE =$( jq -r " .[$i ].updated_at" issue-body) \
779+ GIT_EVENT_DATE =$( jq -r " .[$i ].updated_at" issue-body) \
780780 commit " gi: Import issue #$issue_number from $provider /$user /$repo " \
781781 " Issue URL: https://$provider .com/$user /$repo /issues/$issue_number " \
782782 --author=" $name <$name @users.noreply.$provider .com>"
@@ -829,7 +829,7 @@ export_issues()
829829
830830 rm -f create-body create-header
831831 else
832- echo " Issue $sha hasn't been modified, skipping..."
832+ echo " Issue $sha not modified, skipping..."
833833 fi
834834
835835 # Comments
@@ -850,7 +850,7 @@ export_issues()
850850 if [ -n " $( git rev-list " $lastimport " ..HEAD " $path /comments/$csha " ) " ] || [ -z " $cfound " ] ; then
851851 create_comment " $csha " " $provider " " $user " " $repo " " $num "
852852 else
853- echo " Comment $csha hasn't been modified, skipping..."
853+ echo " Comment $csha not modified, skipping..."
854854 fi
855855 done
856856 fi
@@ -933,7 +933,7 @@ sub_import()
933933usage_exportall ()
934934{
935935 cat << \USAGE_exportall_EOF
936- gi new usage: git issue list [-a] provider user repo
936+ gi new usage: git issue exportall [-a] provider user repo
937937USAGE_exportall_EOF
938938 exit 2
939939}
@@ -951,49 +951,47 @@ sub_exportall()
951951 usage_exportall
952952 ;;
953953 esac
954- done
955- shift $(( OPTIND - 1 )) ;
956-
957- test " $1 " = github -o " $1 " = gitlab || usage_exportall
958- test -n " $2 " -a -n " $3 " || usage_exportall
959- provider=" $1 "
960- user=" $2 "
961- repo=" $3 "
954+ done
955+ shift $(( OPTIND - 1 )) ;
962956
963- # Create list of relevant shas sorted by date
964- shas=$( sub_list -l %i -o %c " $all " | sed ' /^$/d' | tr ' \n' ' ' )
957+ test " $1 " = github -o " $1 " = gitlab || usage_exportall
958+ test -n " $2 " -a -n " $3 " || usage_exportall
959+ provider=" $1 "
960+ user=" $2 "
961+ repo=" $3 "
965962
966- cdissues
963+ # Create list of relevant shas sorted by date
964+ shas=$( sub_list -l %i -o %c " $all " | sed ' /^$/d' | tr ' \n' ' ' )
967965
968- # Remove already exported issues
969- if [ -d " imports/$provider /$user /$repo " ] ; then
970- for i in " imports/$provider /$user /$repo /" [0-9]* ; do
971- shas=$( echo " $shas " | sed " s/$( head -c 7 " $i /sha" ) //" )
972- done
973- fi
966+ cdissues
974967
975- for i in $shas ; do
976- echo " Creating issue $i ..."
977- create_issue -n " $i " " $provider " " $user " " $repo "
978- # get created issue id
979- if [ " $provider " = github ] ; then
980- num=$( jq ' .number' create-body)
981- else
982- num=$( jq ' .iid' create-body)
983- fi
984- rm -f create-header create-body
985-
986- # Create comments
987-
988- path=$( issue_path_part " $i " ) || exit
989- if [ -d " $path /comments" ] ; then
990- local csha cfound
991- git rev-list --reverse --grep=" ^gi comment mark $i " HEAD |
992- while read -r csha ; do
993- create_comment " $csha " " $provider " " $user " " $repo " " $num "
994- done
968+ # Remove already exported issues
969+ if [ -d " imports/$provider /$user /$repo " ] ; then
970+ for i in " imports/$provider /$user /$repo /" [0-9]* ; do
971+ shas=$( echo " $shas " | sed " s/$( head -c 7 " $i /sha" ) //" )
972+ done
995973 fi
996-
997- done
998974
975+ for i in $shas ; do
976+ echo " Creating issue $i ..."
977+ create_issue -n " $i " " $provider " " $user " " $repo "
978+ # get created issue id
979+ if [ " $provider " = github ] ; then
980+ num=$( jq ' .number' create-body)
981+ else
982+ num=$( jq ' .iid' create-body)
983+ fi
984+ rm -f create-header create-body
985+
986+ # Create comments
987+
988+ path=$( issue_path_part " $i " ) || exit
989+ if [ -d " $path /comments" ] ; then
990+ local csha cfound
991+ git rev-list --reverse --grep=" ^gi comment mark $i " HEAD |
992+ while read -r csha ; do
993+ create_comment " $csha " " $provider " " $user " " $repo " " $num "
994+ done
995+ fi
996+ done
999997}
0 commit comments