Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitflow
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tools
gitflow
Commits
c725d726
Commit
c725d726
authored
Jan 23, 2017
by
cmosh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Interrupt feature
parent
322bea17
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
7 deletions
+82
-7
git-flow-feature
git-flow-feature
+82
-7
No files found.
git-flow-feature
View file @
c725d726
...
...
@@ -201,7 +201,7 @@ cmd_start() {
parse_args "$@"
BASE=${2:-$DEVELOP_BRANCH}
require_name_arg
echo ".seconds-feature-$NAME\n.timelog-feature-$NAME" >> .gitignore
echo ".seconds-feature-$NAME\n.timelog-feature-$NAME
\n.breaktime-feature-$NAME
" >> .gitignore
# sanity checks
require_branch_absent "$BRANCH"
...
...
@@ -222,7 +222,7 @@ cmd_start() {
die "Could not create feature branch '$BRANCH'"
fi
echo "How long do you think this feature will take
(in hours
)?"
echo "How long do you think this feature will take
(HH:MM:SS
)?"
read TIME_REQUIRED
...
...
@@ -370,12 +370,15 @@ cmd_finish() {
echo "$TIME_USED" >> ".seconds-feature-$NAME"
TOTAL_BREAK_TIME=$(awk '{ sum += $1 } END { print sum }' .breaktime-feature-$NAME)
TOTAL_TIME=$(awk '{ sum += $1 } END { print sum }' .seconds-feature-$NAME)
TIME_EXPECTED=$(head -n 1 .timelog-feature-$NAME)
seconds=$TOTAL_TIME; FINALTIME=$((seconds/86400))" days "$(date -d "1970-01-01 + $seconds seconds" "+%H hours %M minutes %S seconds")
git commit --allow-empty -m "$BRANCH was completed on $(date), total time taken:$FINALTIME expectde time was $TIME_EXPECTED"
TIME_EXPECTED=$(head -n 1 .timelog-feature-$NAME)
FINALTIME=$((TOTAL_TIME/86400))" days "$(date -d "1970-01-01 + $TOTAL_TIME TOTAL_TIME" "+%H hours %M minutes %S seconds")
TOTAL_TIME_OFF=$((TOTAL_BREAK_TIME/86400))" days "$(date -d "1970-01-01 + $TOTAL_BREAK_TIME TOTAL_BREAK_TIME" "+%H hours %M minutes %S seconds")
git commit --allow-empty -m "$BRANCH was completed on $(date), total time taken:$FINALTIME expectde time was $TIME_EXPECTED, Time spent on breaks was $TOTAL_TIME_OFF"
# when no merge conflict is detected, just clean up the feature branch
...
...
@@ -614,6 +617,53 @@ cmd_pause() {
}
cmd_interrupt() {
parse_args "$@"
require_name_arg
# sanity checks
require_branch "$BRANCH"
require_branch_absent "$BRANCH-paused"
echo $(date +%s) >> ".timelog-feature-$NAME"
LAST_LINE="$(wc -l < .timelog-feature-$NAME)"
PREV_LINE=$((LAST_LINE-1))
LAST_TIME=$(sed "${LAST_LINE}q;d" .timelog-feature-$NAME)
PREV_TIME=$(sed "${PREV_LINE}q;d" .timelog-feature-$NAME)
TIME_USED=$((LAST_TIME-PREV_TIME))
echo "$TIME_USED" >> ".seconds-feature-$NAME"
touch .interrupt-feature-$NAME
seconds=$TIME_USED; TIMESTAMP=$((seconds/86400))" days "$(date -d "1970-01-01 + $seconds seconds" "+%H hours %M minutes %S seconds")
git add --all .
git commit -m "$BRANCH/WIP"
git commit --allow-empty -m "$BRANCH/WIP You were disturbed on $(date), time taken so far:$TIMESTAMP"
git checkout --orphan "$BRANCH-paused"
git reset -- *
echo
echo "Summary of actions:"
echo "- Created orphan branch called '$BRANCH-paused'"
echo "- You are now free to take a break, you have spent $TIMESTAMP in this session"
echo ""
echo "Now, have some coffee and when you are done, use:"
echo ""
echo " git flow feature resume $BRANCH"
echo
}
cmd_resume() {
parse_args "$@"
...
...
@@ -622,12 +672,37 @@ cmd_resume() {
# sanity checks
require_branch "$BRANCH"
if [ -f .interrupt-feature-$NAME ];
then
echo "Why were you interrupted?"
read INTERRUPT_REASON
rm .interrupt-feature-$NAME
else
INTERRUPT_REASON="No reason :)"
fi
LAST_LINE="$(wc -l < .timelog-feature-$NAME)"
LAST_TIME=$(date +%s)
PREV_TIME=$(sed "${LAST_LINE}q;d" .timelog-feature-$NAME)
BREAK_TIME=$((LAST_TIME-PREV_TIME))
echo "$BREAK_TIME" >> ".breaktime-feature-$NAME"
seconds=$BREAK_TIME; TIME_OFF=$((seconds/86400))" days "$(date -d "1970-01-01 + $seconds seconds" "+%H hours %M minutes %S seconds")
git reset -- *
git add .gitignore
git checkout "$BRANCH"
git branch -D "$BRANCH-paused"
git commit --allow-empty -m "$BRANCH/Back to Work at:$(date)"
git commit --allow-empty -m "$BRANCH/Back to Work at:$(date) Time off:$TIME_OFF, Reason: $INTERRUPT_REASON"
echo $(date +%s) >> ".timelog-feature-$NAME"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment