git-scripts 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -55
  3. data/bin/feature +0 -12
  4. data/completion/_feature +1 -1
  5. data/completion/bash_completion.sh +2 -11
  6. data/lib/git.rb +1 -15
  7. data/lib/helpers.rb +1 -47
  8. data/man/feature-finish-issue.1 +2 -2
  9. data/man/feature-finish-issue.1.ronn +1 -1
  10. data/man/feature-finish.1 +2 -2
  11. data/man/feature-finish.1.ronn +1 -1
  12. data/man/feature-github-test.1 +1 -1
  13. data/man/feature-list.1 +2 -2
  14. data/man/feature-list.1.ronn +1 -1
  15. data/man/feature-merge.1 +2 -2
  16. data/man/feature-merge.1.ronn +1 -1
  17. data/man/feature-prune.1 +1 -1
  18. data/man/feature-start.1 +2 -2
  19. data/man/feature-start.1.ronn +1 -1
  20. data/man/feature-stashes.1 +1 -4
  21. data/man/feature-stashes.1.ronn +0 -2
  22. data/man/feature-status.1 +1 -4
  23. data/man/feature-status.1.ronn +0 -2
  24. data/man/feature-switch.1 +2 -2
  25. data/man/feature-switch.1.ronn +1 -1
  26. data/man/feature-url.1 +2 -2
  27. data/man/feature-url.1.ronn +1 -1
  28. data/man/feature.1 +3 -3
  29. data/man/feature.1.ronn +2 -3
  30. data/man/index.txt +0 -7
  31. metadata +4 -23
  32. data/bin/hotfix +0 -230
  33. data/completion/_hotfix +0 -28
  34. data/man/hotfix-finish-issue.1 +0 -22
  35. data/man/hotfix-finish-issue.1.ronn +0 -26
  36. data/man/hotfix-finish.1 +0 -22
  37. data/man/hotfix-finish.1.ronn +0 -25
  38. data/man/hotfix-list.1 +0 -28
  39. data/man/hotfix-list.1.ronn +0 -29
  40. data/man/hotfix-merge.1 +0 -25
  41. data/man/hotfix-merge.1.ronn +0 -29
  42. data/man/hotfix-start.1 +0 -22
  43. data/man/hotfix-start.1.ronn +0 -23
  44. data/man/hotfix-switch.1 +0 -38
  45. data/man/hotfix-switch.1.ronn +0 -33
  46. data/man/hotfix-url.1 +0 -22
  47. data/man/hotfix-url.1.ronn +0 -23
  48. data/man/hotfix.1 +0 -52
  49. data/man/hotfix.1.ronn +0 -41
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cc0297b2c9b3b2feb0d7f3ab4f2d5f995aeab9da56e26ba4f308b38b91d2d6b
4
- data.tar.gz: caeec35a27613bf6e234229449ed8aeceded10a0f77a0799ea471a298a2c734b
3
+ metadata.gz: 3e5d80b708d282d506e10b2c2b2a70efcb888bd8cf85722f70cf8d3d62adcdb0
4
+ data.tar.gz: f087693642161ef49da12207a75471daa82effe96dfc2f63cfc669ab98a50185
5
5
  SHA512:
6
- metadata.gz: 95fbeb5944ad5bf085f704abfa9c0672dbf4b1ea19f2b3acc6d64bb2d28df4dcc514bfd9fffe30164691cd5ce9e40681791be4047fa99f1b302e53c76f2077b9
7
- data.tar.gz: bfdb2bd45601533f0be2d4de08a15c29be5ea25af4f13db0e24c946426ccdbc20ca714de9a384c9d2ee34c41c827ddf569d9f47103861328a4def3bcd3c1114d
6
+ metadata.gz: d4fc9f06c243191725a23cb5fc1baad0dc2e21ad9dbfc69ce0121aaad7207187c4d68bbdc54efe282a300a626d9012ba696fc41aa0f68a9d651ca5002ae24dbf
7
+ data.tar.gz: cee8d4b300803a86a526f2c0a251954ac7977c684c9e64781f32be5c935b5aa102640542bf8494380a8309257f12d48acd5405eb51aed385820870293d1e8590
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Git Scripts
4
4
 
5
- User scripts for easily managing feature branches and hotfixes.
5
+ User scripts for easily managing feature branches.
6
6
 
7
7
  ## Installation
8
8
  ```bash
@@ -16,45 +16,23 @@ git clone git://github.com/iFixit/git-scripts.git
16
16
  cd git-scripts
17
17
  bundle install
18
18
  ln -s ${PWD}/bin/feature /path/to/bin/dir/
19
- ln -s ${PWD}/bin/hotfix /path/to/bin/dir/
20
19
  ```
21
20
 
22
21
  ## Branching Model
23
22
 
24
23
  This is loosely based on the [Git Flow][gitflow] branching model, with a couple
25
24
  of noteable changes. Essentially Git Flow's `develop` is our `master`, Git
26
- Flow's `master` is our `stable`, and there are no `release` branches and our
27
- `hotfix` branch names all have a prefix.
25
+ Flow's `master` is our `stable`, there are no `release` branches nor hotfix
26
+ branches.
28
27
 
29
- **master** is the active development branch, and what our development server
30
- has checked out. This is configurable using: `git config
31
- feature.development_branch branch-name`
32
-
33
- **stable** is the branch which is deployed on the production machines. You
34
- should always be able to check out this branch and get "bug-free" production
35
- code. This branch is always ready-to-go and should always be deployed as soon
36
- as it's changed
28
+ **master** is always deployed. It's also the branch that all feature branches
29
+ start from. This is configurable using: `git config feature.development_branch
30
+ branch-name`
37
31
 
38
32
  **feature branches** are named after the feature you're developing and branched
39
33
  from `master`. When finished, the feature branch is merged back into master
40
34
  with `--no-ff` (so we preserve the merge commit) and deleted.
41
35
 
42
- **hotfix branches** are named `hotfix-name` and branched from `stable`. When
43
- finished, the hotfix branch is merged back into `stable` with `--no-ff` so we
44
- preserve the merge commit. We attempt to merge it back into `master` as well,
45
- but if it's going to get messy just bail.
46
-
47
- ## Deployment
48
-
49
- The production machines always run off the `stable` branch. When deploying,
50
- you need to:
51
-
52
- * Merge `stable` into `master` (and vice-versa). This ensures that the two code
53
- paths come together relatively frequently. This also guarantees that we'll
54
- pick up any stray hotfixes that didn't get merged back.
55
-
56
- * Create a tag on `stable` for keeping track of deploys
57
-
58
36
  ## feature script
59
37
 
60
38
  feature <command> [branch name]
@@ -96,33 +74,6 @@ remote version of the current branch (the upstream).
96
74
  Lists the stashes saved on the current branch if any. -v shows all stashes on
97
75
  all branches.
98
76
 
99
- ## hotfix script
100
-
101
- hotfix <command> [branch name]
102
-
103
- Automates the process of fixing a bug on the live site, similar to the
104
- `feature` script with a few differences. Any command that is run with missing
105
- arguments will just print the help and exit
106
-
107
- hotfix start my-sweet-fix
108
-
109
- Makes a new branch from `stable` named `hotfix_my-sweet-fix`. Prepending the
110
- name with `hotfix_` allows easy filtering.
111
-
112
- hotfix switch my-other-fix
113
-
114
- Switches hotfix branches. Assuming the branch `hotfix_my-other-fix` exists, it
115
- checks out that branch and informs you about any stashes saved on that branch.
116
-
117
- hotfix finish [my-other-fix]
118
-
119
- Creates a pull-request on Github for the current or specified hotfix branch.
120
-
121
- hotfix merge [my-other-fix]
122
-
123
- Merges the hotfix branch back into `stable` with `--no-ff`. Also does a
124
- merge back into `master`.
125
-
126
77
  [gitflow]: http://nvie.com/posts/a-successful-git-branching-model/
127
78
 
128
79
  ## Plugins
@@ -88,10 +88,6 @@ when 'status'
88
88
  when 'finish'
89
89
  feature = ARGV[1] || Git::current_branch
90
90
 
91
- if is_hotfix_branch feature
92
- abort "This is a hotfix branch. Please use hotfix-finish."
93
- end
94
-
95
91
  # Push commits to origin
96
92
  Git::run_safe(["git push origin #{feature}:#{feature}"])
97
93
 
@@ -123,10 +119,6 @@ when 'finish-issue'
123
119
  issue = ARGV[1]
124
120
  feature = Git::current_branch
125
121
 
126
- if is_hotfix_branch feature
127
- abort "This is a hotfix branch. Please use hotfix-finish-issue."
128
- end
129
-
130
122
  # Push commits to origin
131
123
  Git::run_safe(["git push origin #{feature}:#{feature}"])
132
124
 
@@ -183,10 +175,6 @@ when 'merge'
183
175
  feature = ARGV[1] || Git::current_branch
184
176
  end
185
177
 
186
- if is_hotfix_branch feature
187
- exit 1 unless confirm("It looks like this is a hotfix branch. Are you sure you want to merge it into only #{dev_branch}?")
188
- end
189
-
190
178
  pull_info = Github::get_pull_request_info_from_api(feature, dev_branch)
191
179
 
192
180
  warning = Github::get_commit_status_warning(pull_info[:status])
@@ -22,7 +22,7 @@ _feature() {
22
22
  "$words[2]" == "url" ||
23
23
  "$words[2]" == "finish" ]]; then
24
24
  local -a featureBranches args
25
- featureBranches="$(git branch -a | tr -d ' *' | grep -v 'hotfix-' | sed 's|remotes/origin/||')"
25
+ featureBranches="$(git branch -a | tr -d ' *' | sed 's|remotes/origin/||')"
26
26
  args="$(echo ${featureBranches} | tr "\$\'\\n\'" " ")"
27
27
  _arguments '2:Branches:($(echo ${args}))'
28
28
  fi
@@ -12,16 +12,7 @@ _git-scripts()
12
12
  if [ "$line" = "$cmd $cur" ]; then
13
13
  words="switch start finish finish-issue stashes list merge pull status prune url"
14
14
  else
15
- # get branch names minus hotfixes
16
- words="$(git branch -a | tr -d ' *' | grep -v 'hotfix-' | sed 's|remotes/origin/||')"
17
- fi
18
- ;;
19
- hotfix)
20
- if [ "$line" = "$cmd $cur" ]; then
21
- words="switch start finish finish-issue merge list url"
22
- else
23
- # get hotfix branch names
24
- words="$(git branch -a | tr -d ' *' | grep 'hotfix-' | sed -e 's|remotes/origin/||' -e 's|hotfix-||')"
15
+ words="$(git branch -a | tr -d ' *' | sed 's|remotes/origin/||')"
25
16
  fi
26
17
  ;;
27
18
  esac
@@ -30,4 +21,4 @@ _git-scripts()
30
21
  return 0
31
22
  }
32
23
 
33
- complete -F _git-scripts feature hotfix
24
+ complete -F _git-scripts feature
data/lib/git.rb CHANGED
@@ -59,20 +59,6 @@ module Git
59
59
  self::all_branches - self::merged_branches(branch)
60
60
  end
61
61
 
62
- # Returns an array of unmerged hotfix branches
63
- def self.hotfix_branches(type)
64
- stable_branch = get_branch('stable')
65
- branches = if type == :unmerged
66
- self.branches_not_merged_into(stable_branch)
67
- elsif type == :merged
68
- self.merged_branches(stable_branch)
69
- else
70
- raise ArgumentError, 'Must specify :merged or :unmerged in hotfix_branches.'
71
- end
72
-
73
- branches.select {|branch| branch.include?('hotfix-') }
74
- end
75
-
76
62
  # Returns an array of unmerged feature branches
77
63
  def self.feature_branches(type)
78
64
  devBranch = get_branch('development')
@@ -85,7 +71,7 @@ module Git
85
71
  raise ArgumentError, 'Must specify :merged or :unmerged in feature_branches.'
86
72
  end
87
73
 
88
- branches.reject {|branch| branch.include?('hotfix-') }
74
+ branches
89
75
  end
90
76
 
91
77
  # Returns an array of all branch names that have have been merged into the
@@ -31,24 +31,6 @@ def display_feature_help(command = nil, message = nil)
31
31
  )
32
32
  end
33
33
 
34
- def display_hotfix_help(command = nil, message = nil)
35
- display_help(
36
- :script_name => "Git Hotfix Helper",
37
- :commands => {
38
- :list => "hotfix list [-v]",
39
- :url => "hotfix url [name-of-hotfix]",
40
- :start => "hotfix start name-of-hotfix",
41
- :switch => "hotfix switch (name-of-hotfix | -n number-of-hotfix) [options]",
42
- :finish => "hotfix finish [name-of-hotfix]",
43
- :'finish-issue' => "hotfix finish-issue issue-number",
44
- :merge => "hotfix merge (name-of-hotfix | -n number-of-hotfix)",
45
- },
46
- :command_name => 'hotfix',
47
- :command => command,
48
- :message => message
49
- )
50
- end
51
-
52
34
  def display_help(args)
53
35
  command = args[:command]
54
36
  message = args[:message]
@@ -90,11 +72,7 @@ end
90
72
  ##
91
73
  def require_argument(program, command = nil, min = 2, max = 2)
92
74
  help = lambda do |msg|
93
- if program == :hotfix
94
- display_hotfix_help(command, msg)
95
- else
96
- display_feature_help(command, msg)
97
- end
75
+ display_feature_help(command, msg)
98
76
  end
99
77
 
100
78
  if (ARGV.length > max)
@@ -137,30 +115,6 @@ def get_branch_name_from_number(num)
137
115
  return octokit.pull_request(Github::get_github_repo, num).head.ref
138
116
  end
139
117
 
140
- def hotfix_branch(name)
141
- if is_hotfix_branch(name)
142
- return name
143
- else
144
- return "hotfix-#{name}"
145
- end
146
- end
147
-
148
- def current_hotfix_branch()
149
- if ARGV[1] == '-n'
150
- branch = get_branch_name_from_number(ARGV[2])
151
- elsif ARGV[1]
152
- branch = hotfix_branch(ARGV[1])
153
- else
154
- branch = Git::current_branch
155
- end
156
-
157
- return branch
158
- end
159
-
160
- def is_hotfix_branch(name)
161
- name =~ /^hotfix-/
162
- end
163
-
164
118
  def wrap_text(txt, col = 80)
165
119
  txt.gsub(
166
120
  /(.{1,#{col}})(?: +|$)\n?|(.{#{col}})/,
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "FEATURE\-FINISH\-ISSUE" "1" "February 2014" "iFixit" ""
4
+ .TH "FEATURE\-FINISH\-ISSUE" "1" "November 2019" "iFixit" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBfeature\-finish\-issue\fR \- Finish this feature branch and attach it to an issue\.
@@ -16,7 +16,7 @@ Finish the current feature branch and optionally convert an existing issue into
16
16
  Copyright (c) 2012\-2013 iFixit\.
17
17
  .
18
18
  .SH "SEE ALSO"
19
- feature(1), feature\-finish(1), hotfix\-finish(1), hotfix\-finish\-issue(1)
19
+ feature(1), feature\-finish(1)
20
20
  .
21
21
  .SH "WWW"
22
22
  https://github\.com/iFixit/git\-scripts
@@ -18,7 +18,7 @@ Copyright (c) 2012-2013 iFixit.
18
18
 
19
19
  ## SEE ALSO
20
20
 
21
- feature(1), feature-finish(1), hotfix-finish(1), hotfix-finish-issue(1)
21
+ feature(1), feature-finish(1)
22
22
 
23
23
  ## WWW
24
24
 
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "FEATURE\-FINISH" "1" "February 2014" "iFixit" ""
4
+ .TH "FEATURE\-FINISH" "1" "November 2019" "iFixit" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBfeature\-finish\fR \- Finish this feature branch\.
@@ -16,7 +16,7 @@ Finish the current feature branch or the one specified\. Push all remote commits
16
16
  Copyright (c) 2012\-2013 iFixit\.
17
17
  .
18
18
  .SH "SEE ALSO"
19
- feature(1), feature\-finish\-issue(1), hotfix\-finish(1), hotfix\-finish\-issue(1)
19
+ feature(1), feature\-finish\-issue(1)
20
20
  .
21
21
  .SH "WWW"
22
22
  https://github\.com/iFixit/git\-scripts
@@ -18,7 +18,7 @@ Copyright (c) 2012-2013 iFixit.
18
18
 
19
19
  ## SEE ALSO
20
20
 
21
- feature(1), feature-finish-issue(1), hotfix-finish(1), hotfix-finish-issue(1)
21
+ feature(1), feature-finish-issue(1)
22
22
 
23
23
  ## WWW
24
24
 
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "FEATURE\-GITHUB\-TEST" "1" "September 2013" "iFixit" ""
4
+ .TH "FEATURE\-GITHUB\-TEST" "1" "July 2013" "iFixit" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBfeature\-github\-test\fR \- Test Github authentication\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "FEATURE\-LIST" "1" "September 2013" "iFixit" ""
4
+ .TH "FEATURE\-LIST" "1" "November 2019" "iFixit" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBfeature\-list\fR \- Lists the current branch and any available feature branches\.
@@ -22,7 +22,7 @@ List merged branches\.
22
22
  Copyright (c) 2012\-2013 iFixit\.
23
23
  .
24
24
  .SH "SEE ALSO"
25
- feature(1), hotfix\-list(1)
25
+ feature(1)
26
26
  .
27
27
  .SH "WWW"
28
28
  https://github\.com/iFixit/git\-scripts
@@ -21,7 +21,7 @@ Copyright (c) 2012-2013 iFixit.
21
21
 
22
22
  ## SEE ALSO
23
23
 
24
- feature(1), hotfix-list(1)
24
+ feature(1)
25
25
 
26
26
  ## WWW
27
27
 
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "FEATURE\-MERGE" "1" "September 2013" "iFixit" ""
4
+ .TH "FEATURE\-MERGE" "1" "November 2019" "iFixit" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBfeature\-merge\fR \- Merge a feature branch into the development branch\.
@@ -19,7 +19,7 @@ Deletes the local copy of the branch on success\.
19
19
  Copyright (c) 2012\-2013 iFixit\.
20
20
  .
21
21
  .SH "SEE ALSO"
22
- feature(1), hotfix\-merge(1)
22
+ feature(1)
23
23
  .
24
24
  .SH "WWW"
25
25
  https://github\.com/iFixit/git\-scripts
@@ -21,7 +21,7 @@ Copyright (c) 2012-2013 iFixit.
21
21
 
22
22
  ## SEE ALSO
23
23
 
24
- feature(1), hotfix-merge(1)
24
+ feature(1)
25
25
 
26
26
  ## WWW
27
27
 
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "FEATURE\-PRUNE" "1" "September 2013" "iFixit" ""
4
+ .TH "FEATURE\-PRUNE" "1" "July 2013" "iFixit" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBfeature\-prune\fR \- Remove old branches on original or local\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "FEATURE\-START" "1" "September 2013" "iFixit" ""
4
+ .TH "FEATURE\-START" "1" "November 2019" "iFixit" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBfeature\-start\fR \- Start a new feature branch\.
@@ -16,7 +16,7 @@ Start a new feature branch based off \fIfeature\.development\-branch\fR\.
16
16
  Copyright (c) 2012\-2013 iFixit\.
17
17
  .
18
18
  .SH "SEE ALSO"
19
- feature(1), hotfix\-start(1)
19
+ feature(1)
20
20
  .
21
21
  .SH "WWW"
22
22
  https://github\.com/iFixit/git\-scripts
@@ -15,7 +15,7 @@ Copyright (c) 2012-2013 iFixit.
15
15
 
16
16
  ## SEE ALSO
17
17
 
18
- feature(1), hotfix-start(1)
18
+ feature(1)
19
19
 
20
20
  ## WWW
21
21
 
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "FEATURE\-STASHES" "1" "September 2013" "iFixit" ""
4
+ .TH "FEATURE\-STASHES" "1" "November 2019" "iFixit" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBfeature\-stashes\fR \- Show stashes saved on the current branch\.
@@ -12,9 +12,6 @@
12
12
  .SH "DESCRIPTION"
13
13
  Show stashes saved on the current branch\. Display the relative time the stash was saved, the stash message, and instructions on viewing and applying the stash\.
14
14
  .
15
- .P
16
- Compatible with hotfix branches\.
17
- .
18
15
  .SH "OPTIONS"
19
16
  .
20
17
  .TP