git-whistles 0.12.0 → 1.0.1
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/Gemfile.lock +31 -11
- data/README.md +38 -24
- data/bin/git-chop +1 -0
- data/bin/git-jira-branch +168 -0
- data/bin/git-list-branches +1 -0
- data/bin/git-merge-po +1 -0
- data/bin/{git-pull-request → git-pivotal-pr} +39 -18
- data/bin/git-stash-and-checkout +1 -0
- data/git-whistles.gemspec +1 -5
- data/lib/git-whistles/version.rb +1 -1
- data/libexec/git-merge-po.sh +8 -8
- metadata +21 -6
- data/bin/git-chop +0 -17
- data/bin/git-list-branches +0 -17
- data/bin/git-merge-po +0 -17
- data/bin/git-stash-and-checkout +0 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e3781d6b47478166c757dd6b4a39588e16b88c4d
|
|
4
|
+
data.tar.gz: bb8d2ecbe2f95062804370d4dcb717137e562462
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 73585f80f60bef78bc2262f78f77be5d7a6812c9ef4750f260cb66612db61291b5f7c86679cca567391b2e0c5eb68ad656647e1295752f7ae5b13de0b08b67c2
|
|
7
|
+
data.tar.gz: cf981727f3de42a828fb013b294f1c62e7ec1709e0cb0c183453532804b40ee8a8c695ed77a3d93c7e468231da001169781215c21c2e5d1785fe936bb14df1ac
|
data/Gemfile.lock
CHANGED
|
@@ -1,30 +1,44 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
git-whistles (0.
|
|
4
|
+
git-whistles (1.0.1)
|
|
5
|
+
jira-ruby
|
|
5
6
|
pivotal-tracker (~> 0.5.6)
|
|
6
7
|
term-ansicolor
|
|
7
8
|
|
|
8
9
|
GEM
|
|
9
10
|
remote: https://rubygems.org/
|
|
10
11
|
specs:
|
|
12
|
+
activesupport (4.2.5)
|
|
13
|
+
i18n (~> 0.7)
|
|
14
|
+
json (~> 1.7, >= 1.7.7)
|
|
15
|
+
minitest (~> 5.1)
|
|
16
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
|
17
|
+
tzinfo (~> 1.1)
|
|
11
18
|
builder (3.2.2)
|
|
12
19
|
coderay (1.1.0)
|
|
13
|
-
crack (0.4.
|
|
20
|
+
crack (0.4.3)
|
|
14
21
|
safe_yaml (~> 1.0.0)
|
|
15
22
|
diff-lcs (1.2.5)
|
|
16
|
-
domain_name (0.5.
|
|
23
|
+
domain_name (0.5.25)
|
|
17
24
|
unf (>= 0.0.5, < 1.0.0)
|
|
18
25
|
http-cookie (1.0.2)
|
|
19
26
|
domain_name (~> 0.5)
|
|
27
|
+
i18n (0.7.0)
|
|
28
|
+
jira-ruby (0.1.17)
|
|
29
|
+
activesupport
|
|
30
|
+
oauth (~> 0.4.7)
|
|
31
|
+
json (1.8.3)
|
|
20
32
|
method_source (0.8.2)
|
|
21
|
-
mime-types (2.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
mime-types (2.99)
|
|
34
|
+
mini_portile2 (2.0.0)
|
|
35
|
+
minitest (5.8.4)
|
|
36
|
+
netrc (0.11.0)
|
|
37
|
+
nokogiri (1.6.7.2)
|
|
38
|
+
mini_portile2 (~> 2.0.0.rc2)
|
|
26
39
|
nokogiri-happymapper (0.5.9)
|
|
27
40
|
nokogiri (~> 1.5)
|
|
41
|
+
oauth (0.4.7)
|
|
28
42
|
pivotal-tracker (0.5.13)
|
|
29
43
|
builder
|
|
30
44
|
crack
|
|
@@ -57,12 +71,15 @@ GEM
|
|
|
57
71
|
rspec-support (3.2.2)
|
|
58
72
|
safe_yaml (1.0.4)
|
|
59
73
|
slop (3.6.0)
|
|
60
|
-
term-ansicolor (1.3.
|
|
74
|
+
term-ansicolor (1.3.2)
|
|
61
75
|
tins (~> 1.0)
|
|
62
|
-
|
|
76
|
+
thread_safe (0.3.5)
|
|
77
|
+
tins (1.8.2)
|
|
78
|
+
tzinfo (1.2.2)
|
|
79
|
+
thread_safe (~> 0.1)
|
|
63
80
|
unf (0.1.4)
|
|
64
81
|
unf_ext
|
|
65
|
-
unf_ext (0.0.
|
|
82
|
+
unf_ext (0.0.7.1)
|
|
66
83
|
|
|
67
84
|
PLATFORMS
|
|
68
85
|
ruby
|
|
@@ -74,3 +91,6 @@ DEPENDENCIES
|
|
|
74
91
|
pry-nav
|
|
75
92
|
rake
|
|
76
93
|
rspec
|
|
94
|
+
|
|
95
|
+
BUNDLED WITH
|
|
96
|
+
1.10.6
|
data/README.md
CHANGED
|
@@ -7,27 +7,35 @@ Install with:
|
|
|
7
7
|
|
|
8
8
|
gem install git-whistles
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
### Commands available:
|
|
11
11
|
|
|
12
|
+
`git chop [branch1, ...]` - Deletes the local and origin copy of a branch. Useful to close feature branches once a feature is completed. It also accepts multiple branches separated by spaces
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|---------|------------|
|
|
15
|
-
| `git ff-all-branches [-f] [-p] [-v]` | Fast-forward all local tracking branches to their remote counterpart (where possible). Very useful on big projects. |
|
|
16
|
-
| `git stash-and-checkout [branch]` | As the name implies: stash and checkout another branch. |
|
|
17
|
-
| `git pull-request [--from your-branch] [--to target-branch]` | Open your browser at a Github pull-request page for the specified branch (defaults to the current `head`). If you're using Pivotal Tracker and your branch has a story number in its name, populates your pull request with story details. |
|
|
18
|
-
| `git outstanding-features [-f from-branch] [-t to-branch] [--oneline]` | List the pull requests merged in `[to-branch]` but not in `[from-branch]`. Useful to prepare a list of stuff you're going to deploy. Defaults to listing what's on `origin/master` but not on `origin/production`. By default lists one feature per line, if `--oneline` or `-o` is specified features will be separated by spaces instead. [[PedroCunha](https://github.com/PedroCunha)] |
|
|
19
|
-
| `git chop [branch ...]` | Deletes the local and origin copy of a branch. Useful to close feature branches once a feature is completed. It also accepts multiple branches separated by spaces [[David Silva](https://github.com/Davidslv)] |
|
|
20
|
-
| `git list-branches [-l] [-r] [-i integration-branch]` | Colourful listing of all local or origin branches, and their distance to an integration branch (`master` by default). |
|
|
21
|
-
| `git merge-po <ancestor> <left> <right>` | Merge engine for GetText PO files. |
|
|
22
|
-
| `git select <story-id> [-p PREFIX]` | Checkout a local branch with the matching number. If not found, lists remote branches. With -p you can add a prefix to your local branch name. |
|
|
23
|
-
| `git latest-pushes [-n NR_RESULTS] [-p PATTERN]` | Show latest pushed branches to origin. Defaults to 20 results. Pattern is appended to refs/remotes/origin/ so include the team or project name to filter results. [[PedroCunha](https://github.com/PedroCunha)] |
|
|
24
|
-
| `git pivotal-branch <story-id>` | Creates a branch name suggestion from the specified Pivotal Tracker story ID. It also comments on the story the branch name created and starts the story [[dncrht](https://github.com/dncrht)] |
|
|
25
|
-
| `git pivotal-open [story-id]` | Opens the Pivotal Tracker story page for the current branch, from the specified Pivotal Tracker story ID or it is inferred from the branch name if not supplied [[khiet](https://github.com/khiet)] |
|
|
26
|
-
| `git explore [-r REF] [-p PATH]` | Opens the remote origin interface on the given reference and path. Reference defaults to current branch and path to root [[PedroCunha](https://github.com/pedrocunha)]|
|
|
14
|
+
`git explore [-r REF] [-p PATH]` - Opens the remote origin interface on the given reference and path. Reference defaults to current branch and path to root
|
|
27
15
|
|
|
16
|
+
`git ff-all-branches [-f] [-p] [-v]` - Fast-forward all local tracking branches to their remote counterpart (where possible). Very useful on big projects.
|
|
28
17
|
|
|
29
|
-
|
|
18
|
+
`git jira-branch <issue-id>` - Creates a branch name suggestion from the specified JIRA issue ID. It also writes the branch name as a comment on the issue and allows to transition the issue.
|
|
19
|
+
|
|
20
|
+
`git latest-pushes [-n NR_RESULTS] [-p PATTERN]` - Show latest pushed branches to origin. Defaults to 20 results. Pattern is appended to refs/remotes/origin/ so include the team or project name to filter results.
|
|
21
|
+
|
|
22
|
+
`git list-branches [-l] [-r] [-i integration-branch]` - Colourful listing of all local or origin branches, and their distance to an integration branch (`master` by default).
|
|
23
|
+
|
|
24
|
+
`git merge-po <ancestor> <left> <right>` - Merge engine for GetText PO files.
|
|
25
|
+
|
|
26
|
+
`git outstanding-features [-f from-branch] [-t to-branch] [--oneline]` - List the pull requests merged in `[to-branch]` but not in `[from-branch]`. Useful to prepare a list of stuff you're going to deploy. Defaults to listing what's on `origin/master` but not on `origin/production`. By default lists one feature per line, if `--oneline` or `-o` is specified features will be separated by spaces instead.
|
|
27
|
+
|
|
28
|
+
`git pivotal-branch <story-id>` - Creates a branch name suggestion from the specified Pivotal Tracker story ID. It also starts the story and writes the branch name as a comment.
|
|
30
29
|
|
|
30
|
+
`git pivotal-open <story-id>` - Opens the Pivotal Tracker story page for the current branch, from the specified Pivotal Tracker story ID or it is inferred from the branch name if not supplied
|
|
31
|
+
|
|
32
|
+
`git pivotal-pr [--from your-branch] [--to target-branch]` - Open your browser at a Github pull-request page for the specified branch (defaults to the current `head`). If you're using Pivotal Tracker and your branch has a story number in its name, populates your pull request with story details, else it just creates an empty Pull Request from the current HEAD.
|
|
33
|
+
|
|
34
|
+
`git select <story-id> [-p PREFIX] [-r REMOTE_REF]` - Checkout a local branch with the matching number. If not found, lists remote branches. With `-p` you can add a prefix to your local branch name. The `-r` options allows to checkout a branch in remote if you don't have a local branch with that number.
|
|
35
|
+
|
|
36
|
+
`git stash-and-checkout [branch]` - Stash and checkout another branch.
|
|
37
|
+
|
|
38
|
+
### More details on some of the commands
|
|
31
39
|
|
|
32
40
|
#### merge-po
|
|
33
41
|
|
|
@@ -50,19 +58,25 @@ Add this to .gitattributes:
|
|
|
50
58
|
*.po merge=pofile
|
|
51
59
|
*.pot merge=pofile
|
|
52
60
|
|
|
61
|
+
### JIRA
|
|
53
62
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
`git stash-and-checkout [branch]`
|
|
63
|
+
All JIRA commands require a JIRA username, password and site. Please use the following commands
|
|
64
|
+
to set it up:
|
|
57
65
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
```
|
|
67
|
+
$ git config [--global] jira.username <username>
|
|
68
|
+
$ git config [--global] jira.password <password>
|
|
69
|
+
$ git config [--global] jira.site <https://mydomain.atlassian.net>
|
|
70
|
+
```
|
|
61
71
|
|
|
62
|
-
|
|
72
|
+
### Pivotal
|
|
63
73
|
|
|
64
|
-
|
|
74
|
+
All pivotal commands require a Pivotal Tracker token. The token needs to be generated on
|
|
75
|
+
the Pivotal Tracker UI. The token can then be set locally via the following command:
|
|
65
76
|
|
|
77
|
+
```
|
|
78
|
+
$ git config [--global] pivotal-tracker.token <token>
|
|
79
|
+
```
|
|
66
80
|
|
|
67
81
|
### License
|
|
68
82
|
|
data/bin/git-chop
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
../libexec/runner.rb
|
data/bin/git-jira-branch
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# encoding: UTF-8
|
|
3
|
+
#
|
|
4
|
+
# git-jira-branch
|
|
5
|
+
#
|
|
6
|
+
# Suggest a branch name from the given JIRA issue ID
|
|
7
|
+
#
|
|
8
|
+
# Assumes the branches are named as:
|
|
9
|
+
# <issue-id>-<branch-title>
|
|
10
|
+
#
|
|
11
|
+
require 'rubygems'
|
|
12
|
+
require 'optparse'
|
|
13
|
+
require 'jira'
|
|
14
|
+
require 'readline'
|
|
15
|
+
require 'term/ansicolor'
|
|
16
|
+
require 'git-whistles/app'
|
|
17
|
+
|
|
18
|
+
class App < Git::Whistles::App
|
|
19
|
+
|
|
20
|
+
def initialize
|
|
21
|
+
super
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def main(args)
|
|
25
|
+
super
|
|
26
|
+
parse_args!(args)
|
|
27
|
+
|
|
28
|
+
if args.count < 1
|
|
29
|
+
show_and_exit usage
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
issue_id = args[0]
|
|
33
|
+
|
|
34
|
+
# get JIRA Issue info
|
|
35
|
+
issue = get_jira_info(issue_id)
|
|
36
|
+
|
|
37
|
+
branch_name_suggested = "#{issue_id.upcase}-#{issue.fields['summary'].downcase}"
|
|
38
|
+
branch_name_suggested.gsub!(/[^\w\d\/]/, '-').gsub!(/-+/, '-')
|
|
39
|
+
|
|
40
|
+
puts 'The suggested branch name is: ' << Term::ANSIColor.yellow(branch_name_suggested)
|
|
41
|
+
puts ' Press ENTER if you agree'
|
|
42
|
+
puts ' or Write any other name and press ENTER'
|
|
43
|
+
puts ' or Press CTRL-D to cancel'
|
|
44
|
+
|
|
45
|
+
branch_name = Readline.readline ' > ', false
|
|
46
|
+
|
|
47
|
+
if branch_name.nil?
|
|
48
|
+
log.warn "\nCancelled by user"
|
|
49
|
+
exit 2
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
puts 'Would you like to transition the issue?'
|
|
53
|
+
issue.transitions.all.each do |t|
|
|
54
|
+
puts "#{t.id} - #{t.name}"
|
|
55
|
+
end
|
|
56
|
+
puts 'Type the number or enter to continue'
|
|
57
|
+
transition = Readline.readline ' > ', false
|
|
58
|
+
|
|
59
|
+
branch_name = branch_name.empty? ? branch_name_suggested : branch_name
|
|
60
|
+
|
|
61
|
+
# create branch
|
|
62
|
+
`cd #{ENV['PWD']} && git checkout -b #{branch_name}`
|
|
63
|
+
|
|
64
|
+
# issue.notes.create :text => "Created branch #{branch_name}"
|
|
65
|
+
# issue.update :current_state => 'started'
|
|
66
|
+
attrs = {
|
|
67
|
+
update: {
|
|
68
|
+
comment: [ { add: { body: "Created branch #{branch_name}" } } ],
|
|
69
|
+
assignee: [ { set: { name: username } } ]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
issue.save!(attrs)
|
|
73
|
+
|
|
74
|
+
if transition
|
|
75
|
+
attrs = { transition: { id: transition } }
|
|
76
|
+
issue.client.post("#{issue.url}/transitions", attrs.to_json)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
puts Term::ANSIColor.green('Created branch and started JIRA issue')
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
private
|
|
83
|
+
|
|
84
|
+
def usage
|
|
85
|
+
'Usage: git jira-branch JIRA_ID'
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def show_and_exit(message)
|
|
89
|
+
puts message
|
|
90
|
+
exit 1
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def option_parser
|
|
94
|
+
@option_parser ||= OptionParser.new do |op|
|
|
95
|
+
op.banner = usage
|
|
96
|
+
|
|
97
|
+
op.on_tail('-h', '--help', 'Show this message') do
|
|
98
|
+
show_and_exit op
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def username
|
|
104
|
+
@username ||= `git config jira.username`.strip
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def get_jira_info(issue_id)
|
|
108
|
+
if username.empty?
|
|
109
|
+
puts Term::ANSIColor.yellow %Q{
|
|
110
|
+
Your branch appears to have a issue ID,
|
|
111
|
+
but I don't know your JIRA username!
|
|
112
|
+
Please set it with:
|
|
113
|
+
$ git config [--global] jira.username <username>
|
|
114
|
+
}
|
|
115
|
+
die "Aborting."
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
password = `git config jira.password`.strip
|
|
119
|
+
if password.empty?
|
|
120
|
+
puts Term::ANSIColor.yellow %Q{
|
|
121
|
+
Your branch appears to have a issue ID,
|
|
122
|
+
but I don't know your JIRA password!
|
|
123
|
+
Please set it with:
|
|
124
|
+
$ git config [--global] jira.password <password>
|
|
125
|
+
}
|
|
126
|
+
die "Aborting."
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
site = `git config jira.site`.strip
|
|
130
|
+
if site.empty?
|
|
131
|
+
puts Term::ANSIColor.yellow %Q{
|
|
132
|
+
Your branch appears to have a issue ID,
|
|
133
|
+
but I don't know your JIRA site!
|
|
134
|
+
Please set it with:
|
|
135
|
+
$ git config [--global] jira.site <https://mydomain.atlassian.net>
|
|
136
|
+
}
|
|
137
|
+
die "Aborting."
|
|
138
|
+
end
|
|
139
|
+
log.info "Finding your JIRA Issue¬"
|
|
140
|
+
|
|
141
|
+
options = {
|
|
142
|
+
username: username,
|
|
143
|
+
password: password,
|
|
144
|
+
site: site,
|
|
145
|
+
context_path: '',
|
|
146
|
+
auth_type: :basic,
|
|
147
|
+
read_timeout: 120
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
client = JIRA::Client.new(options)
|
|
151
|
+
issue = client.Issue.find(issue_id)
|
|
152
|
+
|
|
153
|
+
log.info '.'
|
|
154
|
+
log.info "Found issue #{issue_id} in '#{issue.fields['project']['name']}'"
|
|
155
|
+
|
|
156
|
+
issue
|
|
157
|
+
rescue => e
|
|
158
|
+
log.info e.message
|
|
159
|
+
|
|
160
|
+
log.warn "Apologies... I could not find issue #{issue_id}."
|
|
161
|
+
exit 1
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
############################################################################
|
|
167
|
+
|
|
168
|
+
App.run!
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
../libexec/runner.rb
|
data/bin/git-merge-po
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
../libexec/runner.rb
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# encoding: UTF-8
|
|
3
3
|
#
|
|
4
|
-
# git-
|
|
4
|
+
# git-pivotal-pr --
|
|
5
5
|
#
|
|
6
6
|
# Open a pull request for the current branch in your default browser
|
|
7
7
|
#
|
|
@@ -18,7 +18,8 @@ require 'git-whistles/app'
|
|
|
18
18
|
|
|
19
19
|
class App < Git::Whistles::App
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
BROWSERS = %w(xdg-open open firefox iceweasel)
|
|
22
|
+
SAFE_QUERY_STRING_SIZE = 8000
|
|
22
23
|
|
|
23
24
|
def initialize
|
|
24
25
|
super
|
|
@@ -57,6 +58,7 @@ class App < Git::Whistles::App
|
|
|
57
58
|
"#{CGI.escape key.to_s}=#{CGI.escape value}"
|
|
58
59
|
}.join('&')
|
|
59
60
|
url = "https://github.com/#{repo}/compare/#{options.to}...#{options.from}?#{query_string}"
|
|
61
|
+
|
|
60
62
|
puts "Preparing a pull request for branch #{options.from}"
|
|
61
63
|
|
|
62
64
|
unless launch_browser(url)
|
|
@@ -64,10 +66,8 @@ class App < Git::Whistles::App
|
|
|
64
66
|
end
|
|
65
67
|
end
|
|
66
68
|
|
|
67
|
-
|
|
68
69
|
private
|
|
69
70
|
|
|
70
|
-
|
|
71
71
|
def defaults
|
|
72
72
|
{
|
|
73
73
|
:from => run!('git symbolic-ref HEAD').strip.gsub(%r(^refs/heads/), ""),
|
|
@@ -78,7 +78,7 @@ class App < Git::Whistles::App
|
|
|
78
78
|
|
|
79
79
|
def option_parser
|
|
80
80
|
@option_parser ||= OptionParser.new do |op|
|
|
81
|
-
op.banner = "Usage: git
|
|
81
|
+
op.banner = "Usage: git pivotal-pr [options]"
|
|
82
82
|
|
|
83
83
|
op.on("-f", "--from YOUR_BRANCH", "Branch to issue pull request for [head]") do |v|
|
|
84
84
|
options.from = v
|
|
@@ -124,11 +124,16 @@ class App < Git::Whistles::App
|
|
|
124
124
|
log.info "Finding your project and story¬"
|
|
125
125
|
|
|
126
126
|
PivotalTracker::Client.token = token
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
begin
|
|
128
|
+
story, project = PivotalTracker::Project.all.find do |project|
|
|
129
|
+
log.info '.¬'
|
|
130
|
+
story = project.stories.find(story_id) and break story, project
|
|
131
|
+
end
|
|
132
|
+
log.info '.'
|
|
133
|
+
rescue RestClient::Unauthorized
|
|
134
|
+
log.info '.'
|
|
135
|
+
die "Your token is not authorized by Pivotal Tracker! Please make sure you have the correct one"
|
|
130
136
|
end
|
|
131
|
-
log.info '.'
|
|
132
137
|
|
|
133
138
|
if story.nil?
|
|
134
139
|
log.warn "Apologies... I could not find story #{story_id}."
|
|
@@ -137,21 +142,37 @@ class App < Git::Whistles::App
|
|
|
137
142
|
|
|
138
143
|
log.info "Found story #{story_id} in '#{project.name}'"
|
|
139
144
|
|
|
140
|
-
|
|
145
|
+
title = "#{project.name}: #{story.name} [##{story.id}]"
|
|
146
|
+
headline = "Pivotal tracker story [##{story_id}](#{story.url}) in project *#{project.name}*:"
|
|
141
147
|
description = story.description.split("\n").map { |line| "> #{line}" }.join("\n")
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
148
|
+
|
|
149
|
+
query.merge! subject: story.name, :"pull_request[title]" => title
|
|
150
|
+
|
|
151
|
+
if (headline.length + description.length) > SAFE_QUERY_STRING_SIZE
|
|
152
|
+
log.warn "Oops looks like your story body exceeds maximum allowed caracters to send a github request"
|
|
153
|
+
log.warn "Please copy the info below to your pull request body:"
|
|
154
|
+
puts
|
|
155
|
+
puts headline
|
|
156
|
+
puts
|
|
157
|
+
puts
|
|
158
|
+
puts description
|
|
159
|
+
puts
|
|
160
|
+
puts
|
|
161
|
+
puts "Press any key to continue..."
|
|
162
|
+
gets
|
|
163
|
+
query.merge! :"pull_request[body]" => "Please check your command line for the story body"
|
|
164
|
+
else
|
|
165
|
+
body = "TODO: describe your changes\n\n===\n\n#{headline}\n\n#{description}"
|
|
166
|
+
query.merge! :"pull_request[body]" => body
|
|
167
|
+
end
|
|
146
168
|
end
|
|
147
169
|
|
|
148
170
|
def launch_browser(url)
|
|
149
|
-
|
|
171
|
+
BROWSERS.each do |command|
|
|
150
172
|
next if run("which #{command}").strip.empty?
|
|
151
|
-
system
|
|
152
|
-
return true
|
|
173
|
+
system(command, url) and return true
|
|
153
174
|
end
|
|
154
|
-
|
|
175
|
+
false
|
|
155
176
|
end
|
|
156
177
|
|
|
157
178
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
../libexec/runner.rb
|
data/git-whistles.gemspec
CHANGED
|
@@ -21,13 +21,9 @@ Gem::Specification.new do |gem|
|
|
|
21
21
|
gem.add_development_dependency "pry-nav"
|
|
22
22
|
gem.add_development_dependency "rspec"
|
|
23
23
|
|
|
24
|
-
if RUBY_VERSION < "1.9"
|
|
25
|
-
gem.add_dependency "nokogiri", "~> 1.5.10"
|
|
26
|
-
gem.add_dependency "mime-types", "~> 1.24"
|
|
27
|
-
end
|
|
28
|
-
|
|
29
24
|
gem.add_dependency "pivotal-tracker", "~> 0.5.6"
|
|
30
25
|
gem.add_dependency "term-ansicolor"
|
|
26
|
+
gem.add_dependency "jira-ruby"
|
|
31
27
|
|
|
32
28
|
gem.files = `git ls-files`.split($\)
|
|
33
29
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/lib/git-whistles/version.rb
CHANGED
data/libexec/git-merge-po.sh
CHANGED
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
# Three-way merge driver for PO files
|
|
4
4
|
#
|
|
5
5
|
set -e
|
|
6
|
-
|
|
6
|
+
IFS=
|
|
7
7
|
# failure handler
|
|
8
8
|
on_error() {
|
|
9
9
|
local parent_lineno="$1"
|
|
10
|
-
local message="$
|
|
11
|
-
local code="$
|
|
10
|
+
local message="$3"
|
|
11
|
+
local code="$2"
|
|
12
12
|
if [[ -n "$message" ]] ; then
|
|
13
|
-
echo "Error on or near line ${parent_lineno}: ${message};
|
|
13
|
+
echo "Error on or near line ${parent_lineno}: ${message}; Code ${code}"
|
|
14
14
|
else
|
|
15
|
-
echo "Error on or near line ${parent_lineno};
|
|
15
|
+
echo "Error on or near line ${parent_lineno}; Code ${code}"
|
|
16
16
|
fi
|
|
17
17
|
exit 255
|
|
18
18
|
}
|
|
19
|
-
trap 'on_error ${LINENO}' ERR
|
|
19
|
+
trap 'on_error ${LINENO} $?' ERR
|
|
20
20
|
|
|
21
21
|
# given a file, find the path that matches its contents
|
|
22
22
|
show_file() {
|
|
@@ -43,7 +43,7 @@ function strip_graveyard() {
|
|
|
43
43
|
# select messages with a conflict marker
|
|
44
44
|
# pass -v to inverse selection
|
|
45
45
|
function grep_conflicts() {
|
|
46
|
-
msggrep $@ --msgstr -F -e '
|
|
46
|
+
msggrep $@ --msgstr -F -e '#-#-#-#-#' -
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
# select messages from $1 that are also in $2 but whose contents have changed
|
|
@@ -105,7 +105,7 @@ m_msgcat -o ${TEMP}.merge3 --use-first ${TEMP}.header ${TEMP}.merge2
|
|
|
105
105
|
cat ${TEMP}.merge3 > $OUTPUT
|
|
106
106
|
|
|
107
107
|
# check for conflicts
|
|
108
|
-
if grep '
|
|
108
|
+
if grep -q '#-#-#-#-#' $OUTPUT ; then
|
|
109
109
|
echo "Conflict(s) detected"
|
|
110
110
|
echo " between ${TEMP}.local and ${TEMP}.remote"
|
|
111
111
|
exit 1
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: git-whistles
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Julien Letessier
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2016-01-22 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -109,6 +109,20 @@ dependencies:
|
|
|
109
109
|
- - ">="
|
|
110
110
|
- !ruby/object:Gem::Version
|
|
111
111
|
version: '0'
|
|
112
|
+
- !ruby/object:Gem::Dependency
|
|
113
|
+
name: jira-ruby
|
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
|
115
|
+
requirements:
|
|
116
|
+
- - ">="
|
|
117
|
+
- !ruby/object:Gem::Version
|
|
118
|
+
version: '0'
|
|
119
|
+
type: :runtime
|
|
120
|
+
prerelease: false
|
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
122
|
+
requirements:
|
|
123
|
+
- - ">="
|
|
124
|
+
- !ruby/object:Gem::Version
|
|
125
|
+
version: '0'
|
|
112
126
|
description: A few helpers for classic Git workflows
|
|
113
127
|
email:
|
|
114
128
|
- julien.letessier@gmail.com
|
|
@@ -116,13 +130,14 @@ executables:
|
|
|
116
130
|
- git-chop
|
|
117
131
|
- git-explore
|
|
118
132
|
- git-ff-all-branches
|
|
133
|
+
- git-jira-branch
|
|
119
134
|
- git-latest-pushes
|
|
120
135
|
- git-list-branches
|
|
121
136
|
- git-merge-po
|
|
122
137
|
- git-outstanding-features
|
|
123
138
|
- git-pivotal-branch
|
|
124
139
|
- git-pivotal-open
|
|
125
|
-
- git-
|
|
140
|
+
- git-pivotal-pr
|
|
126
141
|
- git-select
|
|
127
142
|
- git-stash-and-checkout
|
|
128
143
|
extensions: []
|
|
@@ -139,13 +154,14 @@ files:
|
|
|
139
154
|
- bin/git-chop
|
|
140
155
|
- bin/git-explore
|
|
141
156
|
- bin/git-ff-all-branches
|
|
157
|
+
- bin/git-jira-branch
|
|
142
158
|
- bin/git-latest-pushes
|
|
143
159
|
- bin/git-list-branches
|
|
144
160
|
- bin/git-merge-po
|
|
145
161
|
- bin/git-outstanding-features
|
|
146
162
|
- bin/git-pivotal-branch
|
|
147
163
|
- bin/git-pivotal-open
|
|
148
|
-
- bin/git-
|
|
164
|
+
- bin/git-pivotal-pr
|
|
149
165
|
- bin/git-select
|
|
150
166
|
- bin/git-stash-and-checkout
|
|
151
167
|
- git-whistles.gemspec
|
|
@@ -184,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
184
200
|
version: 1.3.6
|
|
185
201
|
requirements: []
|
|
186
202
|
rubyforge_project:
|
|
187
|
-
rubygems_version: 2.
|
|
203
|
+
rubygems_version: 2.5.1
|
|
188
204
|
signing_key:
|
|
189
205
|
specification_version: 4
|
|
190
206
|
summary: 'A few helpers for classic Git workflows: makes branching and merging, PO
|
|
@@ -195,4 +211,3 @@ test_files:
|
|
|
195
211
|
- spec/data/remote.po
|
|
196
212
|
- spec/git_merge_po_spec.rb
|
|
197
213
|
- spec/spec_helper.rb
|
|
198
|
-
has_rdoc:
|
data/bin/git-chop
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# encoding: UTF-8
|
|
3
|
-
#
|
|
4
|
-
# runner.rb --
|
|
5
|
-
#
|
|
6
|
-
# Run shell scripts from a gem.
|
|
7
|
-
# Symlink to this script to run a script with the same name living in
|
|
8
|
-
# libexec/.
|
|
9
|
-
#
|
|
10
|
-
require 'pathname'
|
|
11
|
-
require 'rubygems'
|
|
12
|
-
require 'git-whistles'
|
|
13
|
-
|
|
14
|
-
target_script = Pathname.new($0).basename
|
|
15
|
-
script_path = Git::Whistles::GEMDIR.join('libexec', "#{target_script}.sh").cleanpath.to_s
|
|
16
|
-
|
|
17
|
-
Kernel.exec script_path, *ARGV
|
data/bin/git-list-branches
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# encoding: UTF-8
|
|
3
|
-
#
|
|
4
|
-
# runner.rb --
|
|
5
|
-
#
|
|
6
|
-
# Run shell scripts from a gem.
|
|
7
|
-
# Symlink to this script to run a script with the same name living in
|
|
8
|
-
# libexec/.
|
|
9
|
-
#
|
|
10
|
-
require 'pathname'
|
|
11
|
-
require 'rubygems'
|
|
12
|
-
require 'git-whistles'
|
|
13
|
-
|
|
14
|
-
target_script = Pathname.new($0).basename
|
|
15
|
-
script_path = Git::Whistles::GEMDIR.join('libexec', "#{target_script}.sh").cleanpath.to_s
|
|
16
|
-
|
|
17
|
-
Kernel.exec script_path, *ARGV
|
data/bin/git-merge-po
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# encoding: UTF-8
|
|
3
|
-
#
|
|
4
|
-
# runner.rb --
|
|
5
|
-
#
|
|
6
|
-
# Run shell scripts from a gem.
|
|
7
|
-
# Symlink to this script to run a script with the same name living in
|
|
8
|
-
# libexec/.
|
|
9
|
-
#
|
|
10
|
-
require 'pathname'
|
|
11
|
-
require 'rubygems'
|
|
12
|
-
require 'git-whistles'
|
|
13
|
-
|
|
14
|
-
target_script = Pathname.new($0).basename
|
|
15
|
-
script_path = Git::Whistles::GEMDIR.join('libexec', "#{target_script}.sh").cleanpath.to_s
|
|
16
|
-
|
|
17
|
-
Kernel.exec script_path, *ARGV
|
data/bin/git-stash-and-checkout
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# encoding: UTF-8
|
|
3
|
-
#
|
|
4
|
-
# runner.rb --
|
|
5
|
-
#
|
|
6
|
-
# Run shell scripts from a gem.
|
|
7
|
-
# Symlink to this script to run a script with the same name living in
|
|
8
|
-
# libexec/.
|
|
9
|
-
#
|
|
10
|
-
require 'pathname'
|
|
11
|
-
require 'rubygems'
|
|
12
|
-
require 'git-whistles'
|
|
13
|
-
|
|
14
|
-
target_script = Pathname.new($0).basename
|
|
15
|
-
script_path = Git::Whistles::GEMDIR.join('libexec', "#{target_script}.sh").cleanpath.to_s
|
|
16
|
-
|
|
17
|
-
Kernel.exec script_path, *ARGV
|