git-process-lib 2.0.0

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.
Files changed (69) hide show
  1. data/CHANGELOG.md +123 -0
  2. data/Gemfile +21 -0
  3. data/Gemfile.lock +57 -0
  4. data/LICENSE +193 -0
  5. data/README.md +342 -0
  6. data/Rakefile +32 -0
  7. data/bin/git-new-fb +39 -0
  8. data/bin/git-pull-request +63 -0
  9. data/bin/git-sync +38 -0
  10. data/bin/git-to-master +44 -0
  11. data/docs/git-new-fb.1.adoc +83 -0
  12. data/docs/git-process.1.adoc +227 -0
  13. data/docs/git-pull-request.1.adoc +166 -0
  14. data/docs/git-sync.1.adoc +120 -0
  15. data/docs/git-to-master.1.adoc +172 -0
  16. data/git-new-fb.gemspec +20 -0
  17. data/git-process-lib.gemspec +25 -0
  18. data/git-process.gemspec +22 -0
  19. data/git-pull-request.gemspec +20 -0
  20. data/git-sync.gemspec +20 -0
  21. data/git-to-master.gemspec +20 -0
  22. data/lib/git-process/abstract_error_builder.rb +53 -0
  23. data/lib/git-process/changed_file_helper.rb +115 -0
  24. data/lib/git-process/git_abstract_merge_error_builder.rb +130 -0
  25. data/lib/git-process/git_branch.rb +105 -0
  26. data/lib/git-process/git_branches.rb +81 -0
  27. data/lib/git-process/git_config.rb +135 -0
  28. data/lib/git-process/git_lib.rb +646 -0
  29. data/lib/git-process/git_logger.rb +84 -0
  30. data/lib/git-process/git_merge_error.rb +28 -0
  31. data/lib/git-process/git_process.rb +159 -0
  32. data/lib/git-process/git_process_error.rb +18 -0
  33. data/lib/git-process/git_process_options.rb +101 -0
  34. data/lib/git-process/git_rebase_error.rb +30 -0
  35. data/lib/git-process/git_remote.rb +222 -0
  36. data/lib/git-process/git_status.rb +108 -0
  37. data/lib/git-process/github_configuration.rb +298 -0
  38. data/lib/git-process/github_pull_request.rb +165 -0
  39. data/lib/git-process/new_fb.rb +49 -0
  40. data/lib/git-process/parked_changes_error.rb +41 -0
  41. data/lib/git-process/pull_request.rb +136 -0
  42. data/lib/git-process/pull_request_error.rb +25 -0
  43. data/lib/git-process/rebase_to_master.rb +148 -0
  44. data/lib/git-process/sync_process.rb +55 -0
  45. data/lib/git-process/syncer.rb +157 -0
  46. data/lib/git-process/uncommitted_changes_error.rb +23 -0
  47. data/lib/git-process/version.rb +22 -0
  48. data/local-build.rb +24 -0
  49. data/spec/FileHelpers.rb +19 -0
  50. data/spec/GitRepoHelper.rb +123 -0
  51. data/spec/changed_file_helper_spec.rb +127 -0
  52. data/spec/git_abstract_merge_error_builder_spec.rb +64 -0
  53. data/spec/git_branch_spec.rb +123 -0
  54. data/spec/git_config_spec.rb +45 -0
  55. data/spec/git_lib_spec.rb +176 -0
  56. data/spec/git_logger_spec.rb +66 -0
  57. data/spec/git_process_spec.rb +208 -0
  58. data/spec/git_remote_spec.rb +227 -0
  59. data/spec/git_status_spec.rb +122 -0
  60. data/spec/github_configuration_spec.rb +152 -0
  61. data/spec/github_pull_request_spec.rb +117 -0
  62. data/spec/github_test_helper.rb +49 -0
  63. data/spec/new_fb_spec.rb +126 -0
  64. data/spec/pull_request_helper.rb +94 -0
  65. data/spec/pull_request_spec.rb +137 -0
  66. data/spec/rebase_to_master_spec.rb +362 -0
  67. data/spec/spec_helper.rb +21 -0
  68. data/spec/sync_spec.rb +1474 -0
  69. metadata +249 -0
@@ -0,0 +1,166 @@
1
+ GIT-PULL-REQUEST(1)
2
+ ===================
3
+ :doctype: manpage
4
+
5
+
6
+ NAME
7
+ ----
8
+ git-pull-request - Creates or gets a GitHub pull request.
9
+
10
+
11
+ SYNOPSIS
12
+ --------
13
+ 'git-pull-request' ['OPTIONS']
14
+
15
+ 'git-pull-request' ['OPTIONS'] 'pull_request_title'
16
+
17
+ 'git-pull-request' ['OPTIONS'] [ 'server/pull_request_number' | 'pull_request_number' ]
18
+
19
+
20
+ DESCRIPTION
21
+ -----------
22
+ 'git-pull-request(1)' creates or gets a pull request on the GitHub
23
+ server associated with the current branch. For the reasons why pull
24
+ requests are useful for the development process,
25
+ see <https://help.github.com/articles/using-pull-requests>
26
+
27
+ The 'git-pull-request(1)' command is a nice, simplified alternative to using the
28
+ web interface that takes advantage of the conventions used in the rest of the
29
+ 'git-process(1)' suite.
30
+
31
+ If no name or number is provided, it is assumed that you want to create a new
32
+ pull request with the same name as the current branch. If a name is explicitly
33
+ given, that is used instead.
34
+
35
+ If a number is given, or a number with a server preceding it (e.g., "origin/23"),
36
+ then this assumes that the number refers to an existing pull request identified
37
+ by that number. In that case, the branch associated with the HEAD of the pull
38
+ request is checked out.
39
+
40
+ The URL for the newly created pull request is shown, making it trivial to make
41
+ any changes you want to it, such as adding additional notes. (Most terminal
42
+ programs allow you to "click through" a URL, though they all differ slightly
43
+ in how. For example, iTerm2 on OS X does it with a Cmd-Click.)
44
+
45
+ The counterpart to this command is 'git-to-master(1)'.
46
+
47
+ It's assumed that you *never* do any work directly on the integration branch:
48
+ everything is done on a feature branch. In addition to being a much
49
+ safer and more flexible way of working in general, it is also a
50
+ requirement to take advantage of same-repo pull request functionality.
51
+
52
+
53
+ OPTIONS
54
+ -------
55
+
56
+ The effective default is "*git pull-request -r -i -f*".
57
+
58
+ *-b <branch>, --base-branch <branch>*::
59
+ The branch on the server that you want this "pulled" into. See the
60
+ 'gitProcess.integrationBranch' configuration item. (*default: the integration branch*)
61
+
62
+ *-e <branch>, --head-branch <branch>*::
63
+ The branch that you want reviewed before being "pulled" into the
64
+ base branch. (*default: the current branch*)
65
+
66
+ *-r <repo>, --repo-name <repo>*::
67
+ The name of the repository to "pull" into. See the 'gitProcess.remoteName'
68
+ configuration item. (*default: the current repository)
69
+
70
+ *-d <desc>, --description <desc>*::
71
+ The description of the Pull Request. Usually includes a nice description of what was
72
+ changed to make things easier for the reviewer.
73
+
74
+ *-u <username>, --user <username>*::
75
+ Your GitHub username. Only needed the first time you connect, and you will be
76
+ prompted for it if needed. Used to generate the value for the 'gitProcess.github.authtoken'
77
+ configuration. See also the 'github.user' configuration item.
78
+
79
+ *-p <password>, --password <password>*::
80
+ Your GitHub password. Only needed the first time you connect, and you will be
81
+ prompted for it if needed. Used to generate the value for the 'gitProcess.github.authtoken'
82
+ configuration.
83
+
84
+ *--info*::
85
+ Informational messages; show the major things this is doing (*default: true*)
86
+
87
+ *-q, --quiet*::
88
+ Quiet messages; only show errors
89
+
90
+ *-v, --verbose*::
91
+ Verbose messages; show lots of details on what this is doing
92
+
93
+ *--version*::
94
+ Print version and exit
95
+
96
+
97
+ CONFIGURATION
98
+ -------------
99
+
100
+ Options for 'git-sync(1)' are set using 'git-config(1)'.
101
+
102
+ *gitProcess.remoteName*::
103
+ Allows you to explicitly set the remote server name to use. Defaults
104
+ to the first server name reported by 'git-remote(1)'.
105
+
106
+ *gitProcess.integrationBranch*::
107
+ Allows you to explicitly set the integration branch to use. Defaults
108
+ to "master".
109
+
110
+ *gitProcess.github.authtoken*::
111
+ Not meant to be set manually, this is the OAuth token used to communicate
112
+ with the GitHub server. If it is not set, the user will be prompted for their credentials.
113
+
114
+ *github.user*::
115
+ If OAuth needs to prompt for credentials, if this value is set then it is
116
+ used as the username. Otherwise it is unused.
117
+
118
+
119
+ GITHUB SUPPORT
120
+ --------------
121
+
122
+ To know which GitHub URL to use, the value of 'gitProcess.remoteName' is resolved
123
+ to the underlying server name/IP. (That includes
124
+ "aliased" names in a 'ssh_config(5)' file.) If it's github.com, then the public
125
+ GitHub.com API is used. Otherwise it's assumed that the server is GitHub Enterprise
126
+ and that set of URLs is used.
127
+
128
+
129
+ EXAMPLE
130
+ -------
131
+
132
+ You've been developing your killer new feature or bug fix, and you want
133
+ someone else to look at it (to do code-review or otherwise provide input).
134
+ 'git-pull-request(1)' synchronizes the current branch with
135
+ the server (effectively executing 'git-sync(1)') and creates the pull request
136
+ against the integration branch.
137
+
138
+
139
+ CONTROL FILES
140
+ -------------
141
+
142
+ *gitprocess-sync-\***--**::
143
+ To help make the process simpler and more reliable, 'git-pull-request(1)' will put a file in the "'.git'" directory
144
+ that contains the SHA-1 of the last successful sync to the server. 'git-to-master(1)' will remove the file
145
+ as part of its normal "housekeeping."
146
+
147
+
148
+ SEE ALSO
149
+ --------
150
+
151
+ *git-process*(1), *git-to-master*(1), *git-new-fb*(1), *git-sync*(1)
152
+
153
+
154
+ BUGS
155
+ ----
156
+ Known bug list: <https://github.com/jdigger/git-process/issues?state=open>
157
+
158
+
159
+ AUTHOR
160
+ ------
161
+ git-sync has been written primarily by Jim Moore.
162
+
163
+
164
+ RESOURCES
165
+ ---------
166
+ Main web site: <https://github.com/jdigger/git-process>
@@ -0,0 +1,120 @@
1
+ GIT-SYNC(1)
2
+ ===========
3
+ :doctype: manpage
4
+
5
+
6
+ NAME
7
+ ----
8
+ git-sync - Syncs local changes with the server.
9
+
10
+
11
+ SYNOPSIS
12
+ --------
13
+ 'git-sync' ['OPTIONS'] [ 'branchname' ]
14
+
15
+
16
+ DESCRIPTION
17
+ -----------
18
+ 'git-sync(1)' fetches the latest repository from the server, rebases/merges
19
+ the current branch against the changes in the integration branch, then pushes
20
+ the result up to a branch on the server of the same name. (Unless told not to.)
21
+
22
+ If a branch name is given, it is assumed that it is a remote branch that you want
23
+ to start doing work on with full 'git-sync(1)' support. The branch will be fetched
24
+ from the server, checked out, and a control file created.
25
+
26
+ There is a lot of logic to make sure that rebasing/merging happens safely and
27
+ with minimal conflicts regardless of things like squashes, multiple people working
28
+ on the same feature branch, etc.
29
+
30
+
31
+ OPTIONS
32
+ -------
33
+
34
+ The effective default is "*git sync -r -i -f*".
35
+
36
+ *-r, --rebase*::
37
+ Rebase instead of merge against the integration branch (*default: true*)
38
+
39
+ *--merge*::
40
+ Merge instead of rebase against the integration branch
41
+
42
+ *-f, --force*::
43
+ Force the push; defaults to *true* if *--rebase* is used
44
+
45
+ *-l, --local*::
46
+ Do not do a push; gets remote changes, but does not update the server
47
+
48
+ *--info*::
49
+ Informational messages; show the major things this is doing (*default: true*)
50
+
51
+ *-q, --quiet*::
52
+ Quiet messages; only show errors
53
+
54
+ *-v, --verbose*::
55
+ Verbose messages; show lots of details on what this is doing
56
+
57
+ *--version*::
58
+ Print version and exit
59
+
60
+
61
+ CONFIGURATION
62
+ -------------
63
+
64
+ Options for 'git-sync(1)' are set using 'git-config(1)'.
65
+
66
+ *gitProcess.remoteName*::
67
+ Allows you to explicitly set the remote server name to use. Defaults
68
+ to the first server name reported by 'git-remote(1)'.
69
+
70
+ *gitProcess.integrationBranch*::
71
+ Allows you to explicitly set the integration branch to use. Defaults
72
+ to "master".
73
+
74
+ *gitProcess.defaultRebaseSync*::
75
+ Should 'git-sync(1)' use *--rebase* by default instead of *--merge*? Defaults to *true*.
76
+
77
+
78
+ EXAMPLE
79
+ -------
80
+
81
+ Assuming that the current branch is called "interesting_changes" and the integration
82
+ branch on the server is "master", typing "git sync" will do roughly the following
83
+ for you:
84
+
85
+ $ git fetch -p
86
+ # if there have been changes on the remote fb since the last sync
87
+ $ git rebase origin/interesting_changes
88
+ $ git rebase origin/master
89
+ # verify nothing has changed in the window of time since the last check
90
+ $ git push origin +interesting_changes:interesting_changes
91
+
92
+
93
+ CONTROL FILES
94
+ -------------
95
+
96
+ *gitprocess-sync-\***--**::
97
+ To help make the process simpler and more reliable, 'git-sync(1)' will put a file in the "'.git'" directory
98
+ that contains the SHA-1 of the last successful sync to the server. 'git-to-master(1)' will remove the file
99
+ as part of its normal "housekeeping."
100
+
101
+
102
+ SEE ALSO
103
+ --------
104
+
105
+ *git-process*(1), *git-to-master*(1), *git-new-fb*(1), *git-pull-request*(1)
106
+
107
+
108
+ BUGS
109
+ ----
110
+ Known bug list: <https://github.com/jdigger/git-process/issues?state=open>
111
+
112
+
113
+ AUTHOR
114
+ ------
115
+ git-sync has been written primarily by Jim Moore.
116
+
117
+
118
+ RESOURCES
119
+ ---------
120
+ Main web site: <https://github.com/jdigger/git-process>
@@ -0,0 +1,172 @@
1
+ GIT-TO-MASTER(1)
2
+ ================
3
+ :doctype: manpage
4
+
5
+
6
+ NAME
7
+ ----
8
+ git-to-master - Rebase against the integration branch, then pushes to it.
9
+
10
+
11
+ SYNOPSIS
12
+ --------
13
+ 'git-to-master' ['OPTIONS'] ['server/pull_request_number' | 'pull_request_number']
14
+
15
+
16
+ DESCRIPTION
17
+ -----------
18
+
19
+ 'git-to-master(1)' fetches the latest changes from the server, rebases against
20
+ the integration branch, pushes to the integration branch, then does
21
+ housecleaning.
22
+
23
+ If there is a problem, such as a merge conflict, this tries to
24
+ resolve it automatically. If it can not do so safely in an automated way,
25
+ if tells you the steps involved for doing so manually.
26
+
27
+ "Housecleaning" includes such things as closing any
28
+ Pull Request that may exist for the branch, removing the (now obsolete)
29
+ local and remote feature branches, and then "parking" on the
30
+ special "'_parking_'" branch.
31
+
32
+ Work is not expected to be done on the "'_parking_'" branch, but any that is
33
+ done is brought over to a newly created feature branch when you do
34
+ 'git-new-fb(1)'.
35
+
36
+ It's assumed that you *never* do any work directly on the integration branch:
37
+ everything is done on a feature branch. In addition to being a much
38
+ safer and more flexible way of working in general, it is also a
39
+ requirement to take advantage of pull request functionality. (See
40
+ 'git-pull-request(1)'.)
41
+
42
+ If a number is given, or a number with a server preceding it (e.g.,
43
+ "origin/23"), then this assumes that the number refers to an existing pull
44
+ request identified by that number. In that case, the branch associated with
45
+ the HEAD of the pull request is checked out before doing the rest of the
46
+ "to-master".
47
+
48
+
49
+ EXAMPLE WITHOUT PULL REQUEST
50
+ ----------------------------
51
+
52
+ Assuming that the current branch is called "interesting_changes" and the
53
+ integration branch on the server is "master", typing "*git to-master*" will do
54
+ roughly the following for you:
55
+
56
+ $ git fetch -p
57
+ $ git rebase origin/master
58
+ $ git push origin interesting_changes:master
59
+ # close pull request if one exists
60
+ $ git checkout -b _parking_ origin/master
61
+ $ git branch -d interesting_changes
62
+ $ git push origin --delete interesting_changes
63
+
64
+ If you use the --keep option, then the process stops after the first "push".
65
+
66
+
67
+ EXAMPLE WITH PULL REQUEST
68
+ -------------------------
69
+
70
+ Assuming that the pull request number is 493, its branch name is "interesting_changes"
71
+ and the integration branch on the server is "master", typing "*git to-master 493*" will
72
+ do roughly the following for you:
73
+
74
+ $ git fetch -p
75
+ # looks up the information for pull-request 493
76
+ $ git checkout -b interesting_changes origin/interesting_changes
77
+ $ git rebase origin/master
78
+ $ git push origin interesting_changes:master
79
+ # close pull request
80
+ $ git checkout -b _parking_ origin/master
81
+ $ git branch -d interesting_changes
82
+ $ git push origin --delete interesting_changes
83
+
84
+ If you would like the review the changes locally first, use 'git-pull-request(1)'
85
+ instead.
86
+
87
+
88
+ OPTIONS
89
+ -------
90
+
91
+ The effective default is "*git to-master --info*".
92
+
93
+ *-k, --keep*::
94
+ Don't do any "cleanup." It keeps the current local and remote branches, and does
95
+ not close any outstanding pull requests.
96
+
97
+ *--info*::
98
+ Informational messages; show the major things this is doing (*default: true*)
99
+
100
+ *-q, --quiet*::
101
+ Quiet messages; only show errors
102
+
103
+ *-v, --verbose*::
104
+ Verbose messages; show lots of details on what this is doing
105
+
106
+ *--version*::
107
+ Print version and exit
108
+
109
+
110
+ CONFIGURATION
111
+ -------------
112
+
113
+ Options for 'git-to-master(1)' are set using 'git-config(1)'.
114
+
115
+ *gitProcess.remoteName*::
116
+ Allows you to explicitly set the remote server name to use. Defaults
117
+ to the first server name reported by 'git-remote(1)' (which is
118
+ typically "origin" since most projects have a single remote).
119
+
120
+ *gitProcess.integrationBranch*::
121
+ Allows you to explicitly set the integration branch to use. Defaults
122
+ to "master".
123
+
124
+ *gitProcess.github.authtoken*::
125
+ Not meant to be set manually, this is the OAuth token used to communicate
126
+ with the GitHub server. If it is not set, the user will be prompted for their credentials.
127
+
128
+ *github.user*::
129
+ If OAuth needs to prompt for credentials, if this value is set then it is
130
+ used as the username. Otherwise it is unused.
131
+
132
+
133
+ CONTROL FILES
134
+ -------------
135
+
136
+ *gitprocess-sync-\***--**::
137
+ To help make the process simpler and more reliable, 'git-to-master(1)' will
138
+ read a file in the "'.git'" directory that contains the SHA-1 of the last
139
+ successful sync to the server. (See 'git-sync(1)'.) As part of its normal
140
+ "housekeeping" 'git-to-master(1)' will remove the file if *--keep* is not
141
+ specified.
142
+
143
+
144
+ GITHUB SUPPORT
145
+ --------------
146
+
147
+ To know which GitHub URL to use for pull-request support, the value of
148
+ 'gitProcess.remoteName' is resolved to the underlying server name/IP. (That includes
149
+ "aliased" names in a 'ssh_config(5)' file.) If it's github.com, then the public
150
+ GitHub.com API is used. Otherwise it's assumed that the server is GitHub Enterprise
151
+ and that set of URLs is used.
152
+
153
+
154
+ SEE ALSO
155
+ --------
156
+
157
+ *git-process*(1), *git-sync*(1), *git-new-fb*(1), *git-pull-request*(1)
158
+
159
+
160
+ BUGS
161
+ ----
162
+ Known bug list: <https://github.com/jdigger/git-process/issues?state=open>
163
+
164
+
165
+ AUTHOR
166
+ ------
167
+ git-to-master has been written primarily by Jim Moore.
168
+
169
+
170
+ RESOURCES
171
+ ---------
172
+ Main web site: <https://github.com/jdigger/git-process>