gitwakatime 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/Gemfile +1 -1
- data/README.md +31 -3
- data/Rakefile +5 -0
- data/gitwakatime.gemspec +1 -1
- data/lib/gitwakatime/cli.rb +2 -2
- data/lib/gitwakatime/mapper.rb +6 -1
- data/lib/gitwakatime/timer.rb +2 -1
- data/lib/gitwakatime/version.rb +1 -1
- data/spec/dummy/dot_git/FETCH_HEAD +1 -0
- data/spec/dummy/dot_git/HEAD +1 -0
- data/spec/dummy/dot_git/config +14 -0
- data/spec/dummy/dot_git/description +1 -0
- data/spec/dummy/dot_git/hooks/applypatch-msg.sample +15 -0
- data/spec/dummy/dot_git/hooks/commit-msg.sample +24 -0
- data/spec/dummy/dot_git/hooks/post-update.sample +8 -0
- data/spec/dummy/dot_git/hooks/pre-applypatch.sample +14 -0
- data/spec/dummy/dot_git/hooks/pre-commit.sample +49 -0
- data/spec/dummy/dot_git/hooks/pre-push.sample +54 -0
- data/spec/dummy/dot_git/hooks/pre-rebase.sample +169 -0
- data/spec/dummy/dot_git/hooks/prepare-commit-msg.sample +36 -0
- data/spec/dummy/dot_git/hooks/update.sample +128 -0
- data/spec/dummy/dot_git/index +0 -0
- data/spec/dummy/dot_git/info/exclude +6 -0
- data/spec/dummy/dot_git/logs/HEAD +1 -0
- data/spec/dummy/dot_git/logs/refs/heads/master +1 -0
- data/spec/dummy/dot_git/logs/refs/remotes/origin/HEAD +1 -0
- data/spec/dummy/dot_git/objects/05/2ff8c0e8c7cd39880d1536f4e27cc554e698f6 +4 -0
- data/spec/dummy/dot_git/objects/22/54dd56976b5f32a2289438842e42a35a18ff86 +2 -0
- data/spec/dummy/dot_git/objects/25/1af04ac94bf6e07db7a96355c1c92abcaab15e +0 -0
- data/spec/dummy/dot_git/objects/2f/43ad7b44490c466283dd479486295ffbd512c0 +2 -0
- data/spec/dummy/dot_git/objects/4c/1ea35f9a811a0ef79da15ec85f25fce4c446ba +2 -0
- data/spec/dummy/dot_git/objects/57/0f1df0505ed828656eeaf9411ddd6a6068b095 +1 -0
- data/spec/dummy/dot_git/objects/57/b0d5cdb6da2b2b9ac7e9847716b0c54466d1c6 +0 -0
- data/spec/dummy/dot_git/objects/65/74f08d639b3bd239dc725d5ca6967277c7c745 +0 -0
- data/spec/dummy/dot_git/objects/65/f07148391ae6ae503b386cc23d305d77bc0fa1 +0 -0
- data/spec/dummy/dot_git/objects/88/6876e0158aa3a5ea31f30bfd1e88af8196ea4d +0 -0
- data/spec/dummy/dot_git/objects/8b/d6648ed130ac9ece0f89cd9a8fbbfd2608427a +0 -0
- data/spec/dummy/dot_git/objects/91/1ac42c4f68e887f6228ea7e2f275fd574fda7c +0 -0
- data/spec/dummy/dot_git/objects/99/b14a6222becff7970dc0534a075c0902479548 +0 -0
- data/spec/dummy/dot_git/objects/a4/c26aeb79acb1f012201fe96e4d68e8d17c75d9 +1 -0
- data/spec/dummy/dot_git/objects/c2/841a877d895366cdc32232c1f63828764e05d3 +0 -0
- data/spec/dummy/dot_git/objects/d3/c45a1a66631f5e6e54283473210a0b20a4c239 +0 -0
- data/spec/dummy/dot_git/objects/d6/42b3c04c3025655a9c33e32b9d530696dcf7cc +1 -0
- data/spec/dummy/dot_git/objects/d6/7eafabb71ca9f0d847134e9a0e864f37013cf6 +0 -0
- data/spec/dummy/dot_git/objects/dc/d748bd06b8a0f239d779bee4f1eaf1f4aa500d +4 -0
- data/spec/dummy/dot_git/objects/e4/93d6f2ab2a702fa7f9c168b852a3b44c524f08 +2 -0
- data/spec/dummy/dot_git/objects/e5/11abe8371d018086bfd23b73e8fe483194f5c7 +0 -0
- data/spec/dummy/dot_git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
- data/spec/dummy/dot_git/objects/e8/0ad49ace82167de62e498622d70377d913c79e +0 -0
- data/spec/dummy/dot_git/objects/ff/6b04c348b3aa1bf8d2e4652f86ebd63a371aed +0 -0
- data/spec/dummy/dot_git/packed-refs +2 -0
- data/spec/dummy/dot_git/refs/heads/master +1 -0
- data/spec/dummy/dot_git/refs/remotes/origin/HEAD +1 -0
- data/spec/dummy/dot_git/sourcetreeconfig +7 -0
- data/spec/dummy/hi +2 -0
- data/spec/dummy/readme +3 -0
- data/spec/mapper_spec.rb +4 -5
- data/spec/query_spec.rb +2 -3
- data/spec/spec_helper.rb +30 -6
- data/spec/timer_spec.rb +3 -4
- metadata +101 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0cf4972a50946fcb26cfdf6170e2a52930ac0b17
|
|
4
|
+
data.tar.gz: 382999961244a24765284c514aa00584574674ab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cbbce74e5296c17b1f363b7471d29bc18cc479d36183ff773aabb41961b3a4d138b2e86123e7006dd150d3bb7c64f48829333dbb84cea8f31181840534d5ca14
|
|
7
|
+
data.tar.gz: e6f8104a2ee6ea1b4d02707dbd4e8331140656a8f5d994300093efcb83c91bbbe1be5b37971b31a4fb5daaddebc97e852eef01de6d00707459a6628a7f3659ed
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
# GitWakaTime
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://travis-ci.org/rposborne/gitwakatime)
|
|
4
|
+
[](http://badge.fury.io/rb/gitwakatime)
|
|
5
|
+
[](https://codeclimate.com/github/rposborne/gitwakatime)
|
|
6
|
+
|
|
7
|
+
GitWakaTime is a mashup between data obtained through "wakatime" and the data we all create using git.
|
|
4
8
|
The prinicpal is to capture a baseline of activity for a task and answer the age old question "How much time did I spend on this?"
|
|
5
9
|
|
|
10
|
+
|
|
11
|
+
|
|
6
12
|
## Installation
|
|
7
13
|
|
|
8
14
|
Install the gem:
|
|
@@ -12,11 +18,33 @@ Install the gem:
|
|
|
12
18
|
## Usage
|
|
13
19
|
|
|
14
20
|
Creates a .gitwakatime.yml file on the user's home directory ~/.gitwakatime.yml which will contain your api keys
|
|
15
|
-
$ gitwakatime init
|
|
21
|
+
$ gitwakatime init
|
|
16
22
|
|
|
17
23
|
Process the current directory
|
|
18
24
|
|
|
19
|
-
$ gitwakatime tally
|
|
25
|
+
$ gitwakatime tally
|
|
26
|
+
|
|
27
|
+
## Output
|
|
28
|
+
Total Recorded time 21 hrs 59 mins 59 secs
|
|
29
|
+
Total Commited Time 18 hrs 50 mins 53 secs
|
|
30
|
+
2015-01-30 Total 2 hrs 40 mins 22 secs
|
|
31
|
+
5f938e6a8 2015-01-30 00:28:07 -0500 1 hr 6 mins 25 secs Adding dependent file tests.
|
|
32
|
+
658ae589e 13 mins 11 secs lib/gitwakatime/timer.rb
|
|
33
|
+
a42b7bc18 53 mins 14 secs spec/commit_spec.rb
|
|
34
|
+
34014889b 2015-01-30 00:27:35 -0500 1 hr 33 mins 57 secs Renaming Parent commit, expose raw commit, and fixed dependent commit time lookup.
|
|
35
|
+
658ae589e 1 hr 43 secs lib/gitwakatime/commit.rb
|
|
36
|
+
658ae589e 33 mins 14 secs lib/gitwakatime/commited_file.rb
|
|
37
|
+
2014-11-14 Total 6 hrs 9 mins 15 secs
|
|
38
|
+
658ae589e 2014-11-14 00:05:45 -0500 6 hrs 9 mins 15 secs Smoothly breaks apart request to multiple queries to wakatime.
|
|
39
|
+
f97f77f0b 13 mins 49 secs README.md
|
|
40
|
+
c983f9fb4 Rakefile
|
|
41
|
+
3575ba3bb 13 mins 59 secs gitwakatime.gemspec
|
|
42
|
+
b0accb9f0 25 mins 11 secs lib/gitwakatime/actions.rb
|
|
43
|
+
3575ba3bb 20 mins 13 secs lib/gitwakatime/cli.rb
|
|
44
|
+
070a759c8 24 mins 31 secs lib/gitwakatime/commit.rb
|
|
45
|
+
25701d955 12 mins 38 secs lib/gitwakatime/commited_file.rb
|
|
46
|
+
fe60ad723 1 hr 56 mins 24 secs lib/gitwakatime/mapper.rb
|
|
47
|
+
83b90c361 2 hrs 22 mins 30 secs lib/gitwakatime/timer.rb
|
|
20
48
|
|
|
21
49
|
## Contributing
|
|
22
50
|
|
data/Rakefile
CHANGED
data/gitwakatime.gemspec
CHANGED
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
19
|
spec.require_paths = ['lib']
|
|
20
20
|
|
|
21
|
-
spec.add_runtime_dependency 'git', '>=
|
|
21
|
+
spec.add_runtime_dependency 'git', '>= 1.2.9.1'
|
|
22
22
|
spec.add_runtime_dependency 'wakatime', '>= 0.0.2'
|
|
23
23
|
spec.add_runtime_dependency 'logger', '>= 0'
|
|
24
24
|
spec.add_runtime_dependency 'thor', '>= 0'
|
data/lib/gitwakatime/cli.rb
CHANGED
|
@@ -18,10 +18,10 @@ module GitWakaTime
|
|
|
18
18
|
method_option :file, aliases: '-f', default: '.'
|
|
19
19
|
|
|
20
20
|
def init
|
|
21
|
+
api_key = ask('What is your wakatime api key? ( Get it here https://wakatime.com/settings):')
|
|
21
22
|
say('Adding .wakatime.yml to home directory')
|
|
22
|
-
|
|
23
23
|
create_file File.join(Dir.home, '.wakatime.yml') do
|
|
24
|
-
YAML.dump(api_key:
|
|
24
|
+
YAML.dump(api_key: api_key, last_commit: nil, log_level: :info)
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
data/lib/gitwakatime/mapper.rb
CHANGED
|
@@ -5,11 +5,16 @@ module GitWakaTime
|
|
|
5
5
|
def initialize(path, commits: 500, start_at: Date.today)
|
|
6
6
|
Log.new 'Mapping commits for dependent commits'
|
|
7
7
|
time = Benchmark.realtime do
|
|
8
|
-
@git =
|
|
8
|
+
@git = if File.directory?(File.join(path, '.git'))
|
|
9
|
+
Git.open(path)
|
|
10
|
+
else
|
|
11
|
+
Git.bare(path)
|
|
12
|
+
end
|
|
9
13
|
|
|
10
14
|
logs = @git.log(commits).since(start_at).until(Date.today)
|
|
11
15
|
|
|
12
16
|
@commits = logs.map do |git_commit|
|
|
17
|
+
next if git_commit.author.name != @git.config('user.name')
|
|
13
18
|
Commit.new(@git, git_commit)
|
|
14
19
|
end.compact
|
|
15
20
|
end
|
data/lib/gitwakatime/timer.rb
CHANGED
|
@@ -51,8 +51,9 @@ module GitWakaTime
|
|
|
51
51
|
# The file should be the same file as we expect
|
|
52
52
|
# TODO: Might need to pass root_path down
|
|
53
53
|
actions = actions.select do |action|
|
|
54
|
-
action['file']
|
|
54
|
+
action['file'].include?(file.name) # This is okay as other projects have already been purged
|
|
55
55
|
end
|
|
56
|
+
|
|
56
57
|
# If this file had an earlier commit ensure the actions timestamp
|
|
57
58
|
# is after that commit
|
|
58
59
|
if file.dependent_commit
|
data/lib/gitwakatime/version.rb
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a4c26aeb79acb1f012201fe96e4d68e8d17c75d9 branch 'master' of https://github.com/rposborne/dummy_repo
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ref: refs/heads/master
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[core]
|
|
2
|
+
repositoryformatversion = 0
|
|
3
|
+
filemode = true
|
|
4
|
+
bare = false
|
|
5
|
+
logallrefupdates = true
|
|
6
|
+
worktree = ../../../../spec/dummy
|
|
7
|
+
ignorecase = true
|
|
8
|
+
precomposeunicode = true
|
|
9
|
+
[remote "origin"]
|
|
10
|
+
url = https://github.com/rposborne/dummy_repo.git
|
|
11
|
+
fetch = +refs/heads/*:refs/remotes/origin/*
|
|
12
|
+
[branch "master"]
|
|
13
|
+
remote = origin
|
|
14
|
+
merge = refs/heads/master
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Unnamed repository; edit this file 'description' to name the repository.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# An example hook script to check the commit log message taken by
|
|
4
|
+
# applypatch from an e-mail message.
|
|
5
|
+
#
|
|
6
|
+
# The hook should exit with non-zero status after issuing an
|
|
7
|
+
# appropriate message if it wants to stop the commit. The hook is
|
|
8
|
+
# allowed to edit the commit message file.
|
|
9
|
+
#
|
|
10
|
+
# To enable this hook, rename this file to "applypatch-msg".
|
|
11
|
+
|
|
12
|
+
. git-sh-setup
|
|
13
|
+
test -x "$GIT_DIR/hooks/commit-msg" &&
|
|
14
|
+
exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
|
|
15
|
+
:
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# An example hook script to check the commit log message.
|
|
4
|
+
# Called by "git commit" with one argument, the name of the file
|
|
5
|
+
# that has the commit message. The hook should exit with non-zero
|
|
6
|
+
# status after issuing an appropriate message if it wants to stop the
|
|
7
|
+
# commit. The hook is allowed to edit the commit message file.
|
|
8
|
+
#
|
|
9
|
+
# To enable this hook, rename this file to "commit-msg".
|
|
10
|
+
|
|
11
|
+
# Uncomment the below to add a Signed-off-by line to the message.
|
|
12
|
+
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
|
|
13
|
+
# hook is more suited to it.
|
|
14
|
+
#
|
|
15
|
+
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
|
16
|
+
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
|
17
|
+
|
|
18
|
+
# This example catches duplicate Signed-off-by lines.
|
|
19
|
+
|
|
20
|
+
test "" = "$(grep '^Signed-off-by: ' "$1" |
|
|
21
|
+
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
|
|
22
|
+
echo >&2 Duplicate Signed-off-by lines.
|
|
23
|
+
exit 1
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# An example hook script to verify what is about to be committed
|
|
4
|
+
# by applypatch from an e-mail message.
|
|
5
|
+
#
|
|
6
|
+
# The hook should exit with non-zero status after issuing an
|
|
7
|
+
# appropriate message if it wants to stop the commit.
|
|
8
|
+
#
|
|
9
|
+
# To enable this hook, rename this file to "pre-applypatch".
|
|
10
|
+
|
|
11
|
+
. git-sh-setup
|
|
12
|
+
test -x "$GIT_DIR/hooks/pre-commit" &&
|
|
13
|
+
exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
|
|
14
|
+
:
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# An example hook script to verify what is about to be committed.
|
|
4
|
+
# Called by "git commit" with no arguments. The hook should
|
|
5
|
+
# exit with non-zero status after issuing an appropriate message if
|
|
6
|
+
# it wants to stop the commit.
|
|
7
|
+
#
|
|
8
|
+
# To enable this hook, rename this file to "pre-commit".
|
|
9
|
+
|
|
10
|
+
if git rev-parse --verify HEAD >/dev/null 2>&1
|
|
11
|
+
then
|
|
12
|
+
against=HEAD
|
|
13
|
+
else
|
|
14
|
+
# Initial commit: diff against an empty tree object
|
|
15
|
+
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# If you want to allow non-ASCII filenames set this variable to true.
|
|
19
|
+
allownonascii=$(git config --bool hooks.allownonascii)
|
|
20
|
+
|
|
21
|
+
# Redirect output to stderr.
|
|
22
|
+
exec 1>&2
|
|
23
|
+
|
|
24
|
+
# Cross platform projects tend to avoid non-ASCII filenames; prevent
|
|
25
|
+
# them from being added to the repository. We exploit the fact that the
|
|
26
|
+
# printable range starts at the space character and ends with tilde.
|
|
27
|
+
if [ "$allownonascii" != "true" ] &&
|
|
28
|
+
# Note that the use of brackets around a tr range is ok here, (it's
|
|
29
|
+
# even required, for portability to Solaris 10's /usr/bin/tr), since
|
|
30
|
+
# the square bracket bytes happen to fall in the designated range.
|
|
31
|
+
test $(git diff --cached --name-only --diff-filter=A -z $against |
|
|
32
|
+
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
|
|
33
|
+
then
|
|
34
|
+
cat <<\EOF
|
|
35
|
+
Error: Attempt to add a non-ASCII file name.
|
|
36
|
+
|
|
37
|
+
This can cause problems if you want to work with people on other platforms.
|
|
38
|
+
|
|
39
|
+
To be portable it is advisable to rename the file.
|
|
40
|
+
|
|
41
|
+
If you know what you are doing you can disable this check using:
|
|
42
|
+
|
|
43
|
+
git config hooks.allownonascii true
|
|
44
|
+
EOF
|
|
45
|
+
exit 1
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
# If there are whitespace errors, print the offending file names and fail.
|
|
49
|
+
exec git diff-index --check --cached $against --
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# An example hook script to verify what is about to be pushed. Called by "git
|
|
4
|
+
# push" after it has checked the remote status, but before anything has been
|
|
5
|
+
# pushed. If this script exits with a non-zero status nothing will be pushed.
|
|
6
|
+
#
|
|
7
|
+
# This hook is called with the following parameters:
|
|
8
|
+
#
|
|
9
|
+
# $1 -- Name of the remote to which the push is being done
|
|
10
|
+
# $2 -- URL to which the push is being done
|
|
11
|
+
#
|
|
12
|
+
# If pushing without using a named remote those arguments will be equal.
|
|
13
|
+
#
|
|
14
|
+
# Information about the commits which are being pushed is supplied as lines to
|
|
15
|
+
# the standard input in the form:
|
|
16
|
+
#
|
|
17
|
+
# <local ref> <local sha1> <remote ref> <remote sha1>
|
|
18
|
+
#
|
|
19
|
+
# This sample shows how to prevent push of commits where the log message starts
|
|
20
|
+
# with "WIP" (work in progress).
|
|
21
|
+
|
|
22
|
+
remote="$1"
|
|
23
|
+
url="$2"
|
|
24
|
+
|
|
25
|
+
z40=0000000000000000000000000000000000000000
|
|
26
|
+
|
|
27
|
+
IFS=' '
|
|
28
|
+
while read local_ref local_sha remote_ref remote_sha
|
|
29
|
+
do
|
|
30
|
+
if [ "$local_sha" = $z40 ]
|
|
31
|
+
then
|
|
32
|
+
# Handle delete
|
|
33
|
+
:
|
|
34
|
+
else
|
|
35
|
+
if [ "$remote_sha" = $z40 ]
|
|
36
|
+
then
|
|
37
|
+
# New branch, examine all commits
|
|
38
|
+
range="$local_sha"
|
|
39
|
+
else
|
|
40
|
+
# Update to existing branch, examine new commits
|
|
41
|
+
range="$remote_sha..$local_sha"
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
# Check for WIP commit
|
|
45
|
+
commit=`git rev-list -n 1 --grep '^WIP' "$range"`
|
|
46
|
+
if [ -n "$commit" ]
|
|
47
|
+
then
|
|
48
|
+
echo >&2 "Found WIP commit in $local_ref, not pushing"
|
|
49
|
+
exit 1
|
|
50
|
+
fi
|
|
51
|
+
fi
|
|
52
|
+
done
|
|
53
|
+
|
|
54
|
+
exit 0
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2006, 2008 Junio C Hamano
|
|
4
|
+
#
|
|
5
|
+
# The "pre-rebase" hook is run just before "git rebase" starts doing
|
|
6
|
+
# its job, and can prevent the command from running by exiting with
|
|
7
|
+
# non-zero status.
|
|
8
|
+
#
|
|
9
|
+
# The hook is called with the following parameters:
|
|
10
|
+
#
|
|
11
|
+
# $1 -- the upstream the series was forked from.
|
|
12
|
+
# $2 -- the branch being rebased (or empty when rebasing the current branch).
|
|
13
|
+
#
|
|
14
|
+
# This sample shows how to prevent topic branches that are already
|
|
15
|
+
# merged to 'next' branch from getting rebased, because allowing it
|
|
16
|
+
# would result in rebasing already published history.
|
|
17
|
+
|
|
18
|
+
publish=next
|
|
19
|
+
basebranch="$1"
|
|
20
|
+
if test "$#" = 2
|
|
21
|
+
then
|
|
22
|
+
topic="refs/heads/$2"
|
|
23
|
+
else
|
|
24
|
+
topic=`git symbolic-ref HEAD` ||
|
|
25
|
+
exit 0 ;# we do not interrupt rebasing detached HEAD
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
case "$topic" in
|
|
29
|
+
refs/heads/??/*)
|
|
30
|
+
;;
|
|
31
|
+
*)
|
|
32
|
+
exit 0 ;# we do not interrupt others.
|
|
33
|
+
;;
|
|
34
|
+
esac
|
|
35
|
+
|
|
36
|
+
# Now we are dealing with a topic branch being rebased
|
|
37
|
+
# on top of master. Is it OK to rebase it?
|
|
38
|
+
|
|
39
|
+
# Does the topic really exist?
|
|
40
|
+
git show-ref -q "$topic" || {
|
|
41
|
+
echo >&2 "No such branch $topic"
|
|
42
|
+
exit 1
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
# Is topic fully merged to master?
|
|
46
|
+
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
|
|
47
|
+
if test -z "$not_in_master"
|
|
48
|
+
then
|
|
49
|
+
echo >&2 "$topic is fully merged to master; better remove it."
|
|
50
|
+
exit 1 ;# we could allow it, but there is no point.
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
# Is topic ever merged to next? If so you should not be rebasing it.
|
|
54
|
+
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
|
|
55
|
+
only_next_2=`git rev-list ^master ${publish} | sort`
|
|
56
|
+
if test "$only_next_1" = "$only_next_2"
|
|
57
|
+
then
|
|
58
|
+
not_in_topic=`git rev-list "^$topic" master`
|
|
59
|
+
if test -z "$not_in_topic"
|
|
60
|
+
then
|
|
61
|
+
echo >&2 "$topic is already up-to-date with master"
|
|
62
|
+
exit 1 ;# we could allow it, but there is no point.
|
|
63
|
+
else
|
|
64
|
+
exit 0
|
|
65
|
+
fi
|
|
66
|
+
else
|
|
67
|
+
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
|
|
68
|
+
/usr/bin/perl -e '
|
|
69
|
+
my $topic = $ARGV[0];
|
|
70
|
+
my $msg = "* $topic has commits already merged to public branch:\n";
|
|
71
|
+
my (%not_in_next) = map {
|
|
72
|
+
/^([0-9a-f]+) /;
|
|
73
|
+
($1 => 1);
|
|
74
|
+
} split(/\n/, $ARGV[1]);
|
|
75
|
+
for my $elem (map {
|
|
76
|
+
/^([0-9a-f]+) (.*)$/;
|
|
77
|
+
[$1 => $2];
|
|
78
|
+
} split(/\n/, $ARGV[2])) {
|
|
79
|
+
if (!exists $not_in_next{$elem->[0]}) {
|
|
80
|
+
if ($msg) {
|
|
81
|
+
print STDERR $msg;
|
|
82
|
+
undef $msg;
|
|
83
|
+
}
|
|
84
|
+
print STDERR " $elem->[1]\n";
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
' "$topic" "$not_in_next" "$not_in_master"
|
|
88
|
+
exit 1
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
exit 0
|
|
92
|
+
|
|
93
|
+
################################################################
|
|
94
|
+
|
|
95
|
+
This sample hook safeguards topic branches that have been
|
|
96
|
+
published from being rewound.
|
|
97
|
+
|
|
98
|
+
The workflow assumed here is:
|
|
99
|
+
|
|
100
|
+
* Once a topic branch forks from "master", "master" is never
|
|
101
|
+
merged into it again (either directly or indirectly).
|
|
102
|
+
|
|
103
|
+
* Once a topic branch is fully cooked and merged into "master",
|
|
104
|
+
it is deleted. If you need to build on top of it to correct
|
|
105
|
+
earlier mistakes, a new topic branch is created by forking at
|
|
106
|
+
the tip of the "master". This is not strictly necessary, but
|
|
107
|
+
it makes it easier to keep your history simple.
|
|
108
|
+
|
|
109
|
+
* Whenever you need to test or publish your changes to topic
|
|
110
|
+
branches, merge them into "next" branch.
|
|
111
|
+
|
|
112
|
+
The script, being an example, hardcodes the publish branch name
|
|
113
|
+
to be "next", but it is trivial to make it configurable via
|
|
114
|
+
$GIT_DIR/config mechanism.
|
|
115
|
+
|
|
116
|
+
With this workflow, you would want to know:
|
|
117
|
+
|
|
118
|
+
(1) ... if a topic branch has ever been merged to "next". Young
|
|
119
|
+
topic branches can have stupid mistakes you would rather
|
|
120
|
+
clean up before publishing, and things that have not been
|
|
121
|
+
merged into other branches can be easily rebased without
|
|
122
|
+
affecting other people. But once it is published, you would
|
|
123
|
+
not want to rewind it.
|
|
124
|
+
|
|
125
|
+
(2) ... if a topic branch has been fully merged to "master".
|
|
126
|
+
Then you can delete it. More importantly, you should not
|
|
127
|
+
build on top of it -- other people may already want to
|
|
128
|
+
change things related to the topic as patches against your
|
|
129
|
+
"master", so if you need further changes, it is better to
|
|
130
|
+
fork the topic (perhaps with the same name) afresh from the
|
|
131
|
+
tip of "master".
|
|
132
|
+
|
|
133
|
+
Let's look at this example:
|
|
134
|
+
|
|
135
|
+
o---o---o---o---o---o---o---o---o---o "next"
|
|
136
|
+
/ / / /
|
|
137
|
+
/ a---a---b A / /
|
|
138
|
+
/ / / /
|
|
139
|
+
/ / c---c---c---c B /
|
|
140
|
+
/ / / \ /
|
|
141
|
+
/ / / b---b C \ /
|
|
142
|
+
/ / / / \ /
|
|
143
|
+
---o---o---o---o---o---o---o---o---o---o---o "master"
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
A, B and C are topic branches.
|
|
147
|
+
|
|
148
|
+
* A has one fix since it was merged up to "next".
|
|
149
|
+
|
|
150
|
+
* B has finished. It has been fully merged up to "master" and "next",
|
|
151
|
+
and is ready to be deleted.
|
|
152
|
+
|
|
153
|
+
* C has not merged to "next" at all.
|
|
154
|
+
|
|
155
|
+
We would want to allow C to be rebased, refuse A, and encourage
|
|
156
|
+
B to be deleted.
|
|
157
|
+
|
|
158
|
+
To compute (1):
|
|
159
|
+
|
|
160
|
+
git rev-list ^master ^topic next
|
|
161
|
+
git rev-list ^master next
|
|
162
|
+
|
|
163
|
+
if these match, topic has not merged in next at all.
|
|
164
|
+
|
|
165
|
+
To compute (2):
|
|
166
|
+
|
|
167
|
+
git rev-list master..topic
|
|
168
|
+
|
|
169
|
+
if this is empty, it is fully merged to "master".
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# An example hook script to prepare the commit log message.
|
|
4
|
+
# Called by "git commit" with the name of the file that has the
|
|
5
|
+
# commit message, followed by the description of the commit
|
|
6
|
+
# message's source. The hook's purpose is to edit the commit
|
|
7
|
+
# message file. If the hook fails with a non-zero status,
|
|
8
|
+
# the commit is aborted.
|
|
9
|
+
#
|
|
10
|
+
# To enable this hook, rename this file to "prepare-commit-msg".
|
|
11
|
+
|
|
12
|
+
# This hook includes three examples. The first comments out the
|
|
13
|
+
# "Conflicts:" part of a merge commit.
|
|
14
|
+
#
|
|
15
|
+
# The second includes the output of "git diff --name-status -r"
|
|
16
|
+
# into the message, just before the "git status" output. It is
|
|
17
|
+
# commented because it doesn't cope with --amend or with squashed
|
|
18
|
+
# commits.
|
|
19
|
+
#
|
|
20
|
+
# The third example adds a Signed-off-by line to the message, that can
|
|
21
|
+
# still be edited. This is rarely a good idea.
|
|
22
|
+
|
|
23
|
+
case "$2,$3" in
|
|
24
|
+
merge,)
|
|
25
|
+
/usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
|
|
26
|
+
|
|
27
|
+
# ,|template,)
|
|
28
|
+
# /usr/bin/perl -i.bak -pe '
|
|
29
|
+
# print "\n" . `git diff --cached --name-status -r`
|
|
30
|
+
# if /^#/ && $first++ == 0' "$1" ;;
|
|
31
|
+
|
|
32
|
+
*) ;;
|
|
33
|
+
esac
|
|
34
|
+
|
|
35
|
+
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
|
36
|
+
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# An example hook script to blocks unannotated tags from entering.
|
|
4
|
+
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
|
|
5
|
+
#
|
|
6
|
+
# To enable this hook, rename this file to "update".
|
|
7
|
+
#
|
|
8
|
+
# Config
|
|
9
|
+
# ------
|
|
10
|
+
# hooks.allowunannotated
|
|
11
|
+
# This boolean sets whether unannotated tags will be allowed into the
|
|
12
|
+
# repository. By default they won't be.
|
|
13
|
+
# hooks.allowdeletetag
|
|
14
|
+
# This boolean sets whether deleting tags will be allowed in the
|
|
15
|
+
# repository. By default they won't be.
|
|
16
|
+
# hooks.allowmodifytag
|
|
17
|
+
# This boolean sets whether a tag may be modified after creation. By default
|
|
18
|
+
# it won't be.
|
|
19
|
+
# hooks.allowdeletebranch
|
|
20
|
+
# This boolean sets whether deleting branches will be allowed in the
|
|
21
|
+
# repository. By default they won't be.
|
|
22
|
+
# hooks.denycreatebranch
|
|
23
|
+
# This boolean sets whether remotely creating branches will be denied
|
|
24
|
+
# in the repository. By default this is allowed.
|
|
25
|
+
#
|
|
26
|
+
|
|
27
|
+
# --- Command line
|
|
28
|
+
refname="$1"
|
|
29
|
+
oldrev="$2"
|
|
30
|
+
newrev="$3"
|
|
31
|
+
|
|
32
|
+
# --- Safety check
|
|
33
|
+
if [ -z "$GIT_DIR" ]; then
|
|
34
|
+
echo "Don't run this script from the command line." >&2
|
|
35
|
+
echo " (if you want, you could supply GIT_DIR then run" >&2
|
|
36
|
+
echo " $0 <ref> <oldrev> <newrev>)" >&2
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
|
|
41
|
+
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
|
|
42
|
+
exit 1
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# --- Config
|
|
46
|
+
allowunannotated=$(git config --bool hooks.allowunannotated)
|
|
47
|
+
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
|
|
48
|
+
denycreatebranch=$(git config --bool hooks.denycreatebranch)
|
|
49
|
+
allowdeletetag=$(git config --bool hooks.allowdeletetag)
|
|
50
|
+
allowmodifytag=$(git config --bool hooks.allowmodifytag)
|
|
51
|
+
|
|
52
|
+
# check for no description
|
|
53
|
+
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
|
|
54
|
+
case "$projectdesc" in
|
|
55
|
+
"Unnamed repository"* | "")
|
|
56
|
+
echo "*** Project description file hasn't been set" >&2
|
|
57
|
+
exit 1
|
|
58
|
+
;;
|
|
59
|
+
esac
|
|
60
|
+
|
|
61
|
+
# --- Check types
|
|
62
|
+
# if $newrev is 0000...0000, it's a commit to delete a ref.
|
|
63
|
+
zero="0000000000000000000000000000000000000000"
|
|
64
|
+
if [ "$newrev" = "$zero" ]; then
|
|
65
|
+
newrev_type=delete
|
|
66
|
+
else
|
|
67
|
+
newrev_type=$(git cat-file -t $newrev)
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
case "$refname","$newrev_type" in
|
|
71
|
+
refs/tags/*,commit)
|
|
72
|
+
# un-annotated tag
|
|
73
|
+
short_refname=${refname##refs/tags/}
|
|
74
|
+
if [ "$allowunannotated" != "true" ]; then
|
|
75
|
+
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
|
|
76
|
+
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
|
|
77
|
+
exit 1
|
|
78
|
+
fi
|
|
79
|
+
;;
|
|
80
|
+
refs/tags/*,delete)
|
|
81
|
+
# delete tag
|
|
82
|
+
if [ "$allowdeletetag" != "true" ]; then
|
|
83
|
+
echo "*** Deleting a tag is not allowed in this repository" >&2
|
|
84
|
+
exit 1
|
|
85
|
+
fi
|
|
86
|
+
;;
|
|
87
|
+
refs/tags/*,tag)
|
|
88
|
+
# annotated tag
|
|
89
|
+
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
|
|
90
|
+
then
|
|
91
|
+
echo "*** Tag '$refname' already exists." >&2
|
|
92
|
+
echo "*** Modifying a tag is not allowed in this repository." >&2
|
|
93
|
+
exit 1
|
|
94
|
+
fi
|
|
95
|
+
;;
|
|
96
|
+
refs/heads/*,commit)
|
|
97
|
+
# branch
|
|
98
|
+
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
|
|
99
|
+
echo "*** Creating a branch is not allowed in this repository" >&2
|
|
100
|
+
exit 1
|
|
101
|
+
fi
|
|
102
|
+
;;
|
|
103
|
+
refs/heads/*,delete)
|
|
104
|
+
# delete branch
|
|
105
|
+
if [ "$allowdeletebranch" != "true" ]; then
|
|
106
|
+
echo "*** Deleting a branch is not allowed in this repository" >&2
|
|
107
|
+
exit 1
|
|
108
|
+
fi
|
|
109
|
+
;;
|
|
110
|
+
refs/remotes/*,commit)
|
|
111
|
+
# tracking branch
|
|
112
|
+
;;
|
|
113
|
+
refs/remotes/*,delete)
|
|
114
|
+
# delete tracking branch
|
|
115
|
+
if [ "$allowdeletebranch" != "true" ]; then
|
|
116
|
+
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
|
|
117
|
+
exit 1
|
|
118
|
+
fi
|
|
119
|
+
;;
|
|
120
|
+
*)
|
|
121
|
+
# Anything else (is there anything else?)
|
|
122
|
+
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
|
|
123
|
+
exit 1
|
|
124
|
+
;;
|
|
125
|
+
esac
|
|
126
|
+
|
|
127
|
+
# --- Finished
|
|
128
|
+
exit 0
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0000000000000000000000000000000000000000 a4c26aeb79acb1f012201fe96e4d68e8d17c75d9 Russell Osborne <russosborn@gmail.com> 1422737446 -0500 clone: from https://github.com/rposborne/dummy_repo.git
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0000000000000000000000000000000000000000 a4c26aeb79acb1f012201fe96e4d68e8d17c75d9 Russell Osborne <russosborn@gmail.com> 1422737446 -0500 clone: from https://github.com/rposborne/dummy_repo.git
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0000000000000000000000000000000000000000 a4c26aeb79acb1f012201fe96e4d68e8d17c75d9 Russell Osborne <russosborn@gmail.com> 1422737446 -0500 clone: from https://github.com/rposborne/dummy_repo.git
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
x��� 1�}Nۀ�\�6 �v��lT�\$���` >���̵�w�I�Cò��;��"�&ˤU�2��2���Lj�vHs�c�."�<鐼��dŔU6DV�$h���o/ܷX��pn�_�>���\���&�2�r�Š�g��
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
x��Kj�0D��)z�UB��B�m��r�<��4H2s�r�l�Q����g��6���B�b�j�-!�6�Jp&i�J��-OjRX�IqB�V8��Y'S���ّC"nv�k�k����ծ�k����qR~|���e��k������e�sې����u�Cjy�"p�\8�����hm�AZN
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
x���m�0D��)�@J&m (�l��4���BV2�v�~����iٶG�@�G�f���I��l��&\y ���fb��G��
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a4c26aeb79acb1f012201fe96e4d68e8d17c75d9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ref: refs/remotes/origin/master
|
data/spec/dummy/hi
ADDED
data/spec/dummy/readme
ADDED
data/spec/mapper_spec.rb
CHANGED
|
@@ -3,19 +3,18 @@ require 'gitwakatime'
|
|
|
3
3
|
require 'gitwakatime/mapper'
|
|
4
4
|
|
|
5
5
|
describe 'description' do
|
|
6
|
-
let(:path) { File.join(File.dirname(__FILE__), 'dummy') }
|
|
7
6
|
it 'can be run on dummy' do
|
|
8
|
-
expect(GitWakaTime::Mapper.new(
|
|
7
|
+
expect(GitWakaTime::Mapper.new(@wdir).commits.size).to eq 8 # 9ths is lonely
|
|
9
8
|
end
|
|
10
9
|
it 'can be run on dummy' do
|
|
11
|
-
expect(GitWakaTime::Mapper.new(
|
|
10
|
+
expect(GitWakaTime::Mapper.new(@wdir).commits.last.raw_commit.message).to eq 'created readme'
|
|
12
11
|
end
|
|
13
12
|
|
|
14
13
|
it 'maps files dependent commits' do
|
|
15
|
-
expect(GitWakaTime::Mapper.new(
|
|
14
|
+
expect(GitWakaTime::Mapper.new(@wdir).commits.first.files.first.dependent_commit.sha).to eq 'dcd748bd06b8a0f239d779bee4f1eaf1f4aa500d'
|
|
16
15
|
end
|
|
17
16
|
|
|
18
17
|
it 'maps files dependent commits' do
|
|
19
|
-
expect(GitWakaTime::Mapper.new(
|
|
18
|
+
expect(GitWakaTime::Mapper.new(@wdir).commits.select { |c| c.sha == 'dcd748bd06b8a0f239d779bee4f1eaf1f4aa500d' }.first.files.first.dependent_commit.sha).to eq '2254dd56976b5f32a2289438842e42a35a18ff86'
|
|
20
19
|
end
|
|
21
20
|
end
|
data/spec/query_spec.rb
CHANGED
|
@@ -2,8 +2,7 @@ require 'spec_helper'
|
|
|
2
2
|
require 'gitwakatime'
|
|
3
3
|
|
|
4
4
|
describe 'description' do
|
|
5
|
-
let(:
|
|
6
|
-
let (:map) { GitWakaTime::Mapper.new(path) }
|
|
5
|
+
let (:map) { GitWakaTime::Mapper.new(@wdir) }
|
|
7
6
|
|
|
8
7
|
before do
|
|
9
8
|
stub_request(:get, 'https://wakatime.com/api/v1/actions')
|
|
@@ -13,7 +12,7 @@ describe 'description' do
|
|
|
13
12
|
|
|
14
13
|
it 'can be run on dummy' do
|
|
15
14
|
|
|
16
|
-
timer = GitWakaTime::Query.new(map.commits, File.basename(
|
|
15
|
+
timer = GitWakaTime::Query.new(map.commits, File.basename(@wdir)).get
|
|
17
16
|
|
|
18
17
|
expect(timer.size).to eq 6 # 9ths is lonely
|
|
19
18
|
expect(timer).to be_a Array
|
data/spec/spec_helper.rb
CHANGED
|
@@ -7,12 +7,36 @@
|
|
|
7
7
|
RSpec.configure do |config|
|
|
8
8
|
config.run_all_when_everything_filtered = true
|
|
9
9
|
config.filter_run :focus
|
|
10
|
-
|
|
11
|
-
# Run specs in random order to surface order dependencies. If you find an
|
|
12
|
-
# order dependency and want to debug it, you can fix the order by providing
|
|
13
|
-
# the seed, which is printed after each run.
|
|
14
|
-
# --seed 1234
|
|
15
10
|
config.order = 'random'
|
|
16
|
-
|
|
11
|
+
config.before(:all) do
|
|
12
|
+
@wdir = set_file_paths
|
|
13
|
+
end
|
|
17
14
|
|
|
15
|
+
config.after(:all) do
|
|
16
|
+
FileUtils.rm_r(File.dirname(@wdir))
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
require 'codeclimate-test-reporter'
|
|
20
|
+
CodeClimate::TestReporter.start
|
|
18
21
|
require 'webmock/rspec'
|
|
22
|
+
|
|
23
|
+
WebMock.disable_net_connect!(allow: 'codeclimate.com')
|
|
24
|
+
|
|
25
|
+
def set_file_paths
|
|
26
|
+
@test_dir = File.join(File.dirname(__FILE__))
|
|
27
|
+
@wdir_dot = File.expand_path(File.join(@test_dir, 'dummy'))
|
|
28
|
+
@wdir = create_temp_repo(@wdir_dot)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def create_temp_repo(clone_path)
|
|
32
|
+
filename = 'git_test' + Time.now.to_i.to_s + rand(300).to_s.rjust(3, '0')
|
|
33
|
+
@tmp_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp', filename))
|
|
34
|
+
FileUtils.mkdir_p(@tmp_path)
|
|
35
|
+
FileUtils.cp_r(clone_path, @tmp_path)
|
|
36
|
+
tmp_path = File.join(@tmp_path, 'dummy')
|
|
37
|
+
Dir.chdir(tmp_path) do
|
|
38
|
+
FileUtils.mv('dot_git', '.git')
|
|
39
|
+
end
|
|
40
|
+
puts tmp_path
|
|
41
|
+
tmp_path
|
|
42
|
+
end
|
data/spec/timer_spec.rb
CHANGED
|
@@ -2,8 +2,7 @@ require 'spec_helper'
|
|
|
2
2
|
require 'gitwakatime'
|
|
3
3
|
|
|
4
4
|
describe 'description' do
|
|
5
|
-
let(:
|
|
6
|
-
let (:map) { GitWakaTime::Mapper.new(path) }
|
|
5
|
+
let (:map) { GitWakaTime::Mapper.new(@wdir) }
|
|
7
6
|
|
|
8
7
|
before do
|
|
9
8
|
stub_request(:get, 'https://wakatime.com/api/v1/actions')
|
|
@@ -12,8 +11,8 @@ describe 'description' do
|
|
|
12
11
|
end
|
|
13
12
|
|
|
14
13
|
it 'can be run on dummy' do
|
|
15
|
-
actions = GitWakaTime::Query.new(map.commits, File.basename(
|
|
16
|
-
timer = GitWakaTime::Timer.new(map.commits, actions, File.basename(
|
|
14
|
+
actions = GitWakaTime::Query.new(map.commits, File.basename(@wdir)).get
|
|
15
|
+
timer = GitWakaTime::Timer.new(map.commits, actions, File.basename(@wdir)).process
|
|
17
16
|
expect(timer.size).to eq 2
|
|
18
17
|
end
|
|
19
18
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gitwakatime
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Russell Osborne
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-02-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: git
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 1.2.9.1
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 1.2.9.1
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: wakatime
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -175,6 +175,7 @@ extra_rdoc_files: []
|
|
|
175
175
|
files:
|
|
176
176
|
- ".gitignore"
|
|
177
177
|
- ".rspec"
|
|
178
|
+
- ".travis.yml"
|
|
178
179
|
- Gemfile
|
|
179
180
|
- LICENSE.txt
|
|
180
181
|
- README.md
|
|
@@ -191,6 +192,54 @@ files:
|
|
|
191
192
|
- lib/gitwakatime/query.rb
|
|
192
193
|
- lib/gitwakatime/timer.rb
|
|
193
194
|
- lib/gitwakatime/version.rb
|
|
195
|
+
- spec/dummy/dot_git/FETCH_HEAD
|
|
196
|
+
- spec/dummy/dot_git/HEAD
|
|
197
|
+
- spec/dummy/dot_git/config
|
|
198
|
+
- spec/dummy/dot_git/description
|
|
199
|
+
- spec/dummy/dot_git/hooks/applypatch-msg.sample
|
|
200
|
+
- spec/dummy/dot_git/hooks/commit-msg.sample
|
|
201
|
+
- spec/dummy/dot_git/hooks/post-update.sample
|
|
202
|
+
- spec/dummy/dot_git/hooks/pre-applypatch.sample
|
|
203
|
+
- spec/dummy/dot_git/hooks/pre-commit.sample
|
|
204
|
+
- spec/dummy/dot_git/hooks/pre-push.sample
|
|
205
|
+
- spec/dummy/dot_git/hooks/pre-rebase.sample
|
|
206
|
+
- spec/dummy/dot_git/hooks/prepare-commit-msg.sample
|
|
207
|
+
- spec/dummy/dot_git/hooks/update.sample
|
|
208
|
+
- spec/dummy/dot_git/index
|
|
209
|
+
- spec/dummy/dot_git/info/exclude
|
|
210
|
+
- spec/dummy/dot_git/logs/HEAD
|
|
211
|
+
- spec/dummy/dot_git/logs/refs/heads/master
|
|
212
|
+
- spec/dummy/dot_git/logs/refs/remotes/origin/HEAD
|
|
213
|
+
- spec/dummy/dot_git/objects/05/2ff8c0e8c7cd39880d1536f4e27cc554e698f6
|
|
214
|
+
- spec/dummy/dot_git/objects/22/54dd56976b5f32a2289438842e42a35a18ff86
|
|
215
|
+
- spec/dummy/dot_git/objects/25/1af04ac94bf6e07db7a96355c1c92abcaab15e
|
|
216
|
+
- spec/dummy/dot_git/objects/2f/43ad7b44490c466283dd479486295ffbd512c0
|
|
217
|
+
- spec/dummy/dot_git/objects/4c/1ea35f9a811a0ef79da15ec85f25fce4c446ba
|
|
218
|
+
- spec/dummy/dot_git/objects/57/0f1df0505ed828656eeaf9411ddd6a6068b095
|
|
219
|
+
- spec/dummy/dot_git/objects/57/b0d5cdb6da2b2b9ac7e9847716b0c54466d1c6
|
|
220
|
+
- spec/dummy/dot_git/objects/65/74f08d639b3bd239dc725d5ca6967277c7c745
|
|
221
|
+
- spec/dummy/dot_git/objects/65/f07148391ae6ae503b386cc23d305d77bc0fa1
|
|
222
|
+
- spec/dummy/dot_git/objects/88/6876e0158aa3a5ea31f30bfd1e88af8196ea4d
|
|
223
|
+
- spec/dummy/dot_git/objects/8b/d6648ed130ac9ece0f89cd9a8fbbfd2608427a
|
|
224
|
+
- spec/dummy/dot_git/objects/91/1ac42c4f68e887f6228ea7e2f275fd574fda7c
|
|
225
|
+
- spec/dummy/dot_git/objects/99/b14a6222becff7970dc0534a075c0902479548
|
|
226
|
+
- spec/dummy/dot_git/objects/a4/c26aeb79acb1f012201fe96e4d68e8d17c75d9
|
|
227
|
+
- spec/dummy/dot_git/objects/c2/841a877d895366cdc32232c1f63828764e05d3
|
|
228
|
+
- spec/dummy/dot_git/objects/d3/c45a1a66631f5e6e54283473210a0b20a4c239
|
|
229
|
+
- spec/dummy/dot_git/objects/d6/42b3c04c3025655a9c33e32b9d530696dcf7cc
|
|
230
|
+
- spec/dummy/dot_git/objects/d6/7eafabb71ca9f0d847134e9a0e864f37013cf6
|
|
231
|
+
- spec/dummy/dot_git/objects/dc/d748bd06b8a0f239d779bee4f1eaf1f4aa500d
|
|
232
|
+
- spec/dummy/dot_git/objects/e4/93d6f2ab2a702fa7f9c168b852a3b44c524f08
|
|
233
|
+
- spec/dummy/dot_git/objects/e5/11abe8371d018086bfd23b73e8fe483194f5c7
|
|
234
|
+
- spec/dummy/dot_git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
|
|
235
|
+
- spec/dummy/dot_git/objects/e8/0ad49ace82167de62e498622d70377d913c79e
|
|
236
|
+
- spec/dummy/dot_git/objects/ff/6b04c348b3aa1bf8d2e4652f86ebd63a371aed
|
|
237
|
+
- spec/dummy/dot_git/packed-refs
|
|
238
|
+
- spec/dummy/dot_git/refs/heads/master
|
|
239
|
+
- spec/dummy/dot_git/refs/remotes/origin/HEAD
|
|
240
|
+
- spec/dummy/dot_git/sourcetreeconfig
|
|
241
|
+
- spec/dummy/hi
|
|
242
|
+
- spec/dummy/readme
|
|
194
243
|
- spec/fixtures/actions.json
|
|
195
244
|
- spec/mapper_spec.rb
|
|
196
245
|
- spec/query_spec.rb
|
|
@@ -222,6 +271,54 @@ specification_version: 4
|
|
|
222
271
|
summary: A Tool that will compile git data with wakatime data to establish time per
|
|
223
272
|
commit
|
|
224
273
|
test_files:
|
|
274
|
+
- spec/dummy/dot_git/FETCH_HEAD
|
|
275
|
+
- spec/dummy/dot_git/HEAD
|
|
276
|
+
- spec/dummy/dot_git/config
|
|
277
|
+
- spec/dummy/dot_git/description
|
|
278
|
+
- spec/dummy/dot_git/hooks/applypatch-msg.sample
|
|
279
|
+
- spec/dummy/dot_git/hooks/commit-msg.sample
|
|
280
|
+
- spec/dummy/dot_git/hooks/post-update.sample
|
|
281
|
+
- spec/dummy/dot_git/hooks/pre-applypatch.sample
|
|
282
|
+
- spec/dummy/dot_git/hooks/pre-commit.sample
|
|
283
|
+
- spec/dummy/dot_git/hooks/pre-push.sample
|
|
284
|
+
- spec/dummy/dot_git/hooks/pre-rebase.sample
|
|
285
|
+
- spec/dummy/dot_git/hooks/prepare-commit-msg.sample
|
|
286
|
+
- spec/dummy/dot_git/hooks/update.sample
|
|
287
|
+
- spec/dummy/dot_git/index
|
|
288
|
+
- spec/dummy/dot_git/info/exclude
|
|
289
|
+
- spec/dummy/dot_git/logs/HEAD
|
|
290
|
+
- spec/dummy/dot_git/logs/refs/heads/master
|
|
291
|
+
- spec/dummy/dot_git/logs/refs/remotes/origin/HEAD
|
|
292
|
+
- spec/dummy/dot_git/objects/05/2ff8c0e8c7cd39880d1536f4e27cc554e698f6
|
|
293
|
+
- spec/dummy/dot_git/objects/22/54dd56976b5f32a2289438842e42a35a18ff86
|
|
294
|
+
- spec/dummy/dot_git/objects/25/1af04ac94bf6e07db7a96355c1c92abcaab15e
|
|
295
|
+
- spec/dummy/dot_git/objects/2f/43ad7b44490c466283dd479486295ffbd512c0
|
|
296
|
+
- spec/dummy/dot_git/objects/4c/1ea35f9a811a0ef79da15ec85f25fce4c446ba
|
|
297
|
+
- spec/dummy/dot_git/objects/57/0f1df0505ed828656eeaf9411ddd6a6068b095
|
|
298
|
+
- spec/dummy/dot_git/objects/57/b0d5cdb6da2b2b9ac7e9847716b0c54466d1c6
|
|
299
|
+
- spec/dummy/dot_git/objects/65/74f08d639b3bd239dc725d5ca6967277c7c745
|
|
300
|
+
- spec/dummy/dot_git/objects/65/f07148391ae6ae503b386cc23d305d77bc0fa1
|
|
301
|
+
- spec/dummy/dot_git/objects/88/6876e0158aa3a5ea31f30bfd1e88af8196ea4d
|
|
302
|
+
- spec/dummy/dot_git/objects/8b/d6648ed130ac9ece0f89cd9a8fbbfd2608427a
|
|
303
|
+
- spec/dummy/dot_git/objects/91/1ac42c4f68e887f6228ea7e2f275fd574fda7c
|
|
304
|
+
- spec/dummy/dot_git/objects/99/b14a6222becff7970dc0534a075c0902479548
|
|
305
|
+
- spec/dummy/dot_git/objects/a4/c26aeb79acb1f012201fe96e4d68e8d17c75d9
|
|
306
|
+
- spec/dummy/dot_git/objects/c2/841a877d895366cdc32232c1f63828764e05d3
|
|
307
|
+
- spec/dummy/dot_git/objects/d3/c45a1a66631f5e6e54283473210a0b20a4c239
|
|
308
|
+
- spec/dummy/dot_git/objects/d6/42b3c04c3025655a9c33e32b9d530696dcf7cc
|
|
309
|
+
- spec/dummy/dot_git/objects/d6/7eafabb71ca9f0d847134e9a0e864f37013cf6
|
|
310
|
+
- spec/dummy/dot_git/objects/dc/d748bd06b8a0f239d779bee4f1eaf1f4aa500d
|
|
311
|
+
- spec/dummy/dot_git/objects/e4/93d6f2ab2a702fa7f9c168b852a3b44c524f08
|
|
312
|
+
- spec/dummy/dot_git/objects/e5/11abe8371d018086bfd23b73e8fe483194f5c7
|
|
313
|
+
- spec/dummy/dot_git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
|
|
314
|
+
- spec/dummy/dot_git/objects/e8/0ad49ace82167de62e498622d70377d913c79e
|
|
315
|
+
- spec/dummy/dot_git/objects/ff/6b04c348b3aa1bf8d2e4652f86ebd63a371aed
|
|
316
|
+
- spec/dummy/dot_git/packed-refs
|
|
317
|
+
- spec/dummy/dot_git/refs/heads/master
|
|
318
|
+
- spec/dummy/dot_git/refs/remotes/origin/HEAD
|
|
319
|
+
- spec/dummy/dot_git/sourcetreeconfig
|
|
320
|
+
- spec/dummy/hi
|
|
321
|
+
- spec/dummy/readme
|
|
225
322
|
- spec/fixtures/actions.json
|
|
226
323
|
- spec/mapper_spec.rb
|
|
227
324
|
- spec/query_spec.rb
|