Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bd3f53d
Replace .netrc support by git credential
jd May 7, 2019
7565f67
Merge pull request #55 from jd/git-credential
mergify[bot] May 7, 2019
42baa0b
Switch to pytest
jd May 7, 2019
6273a03
Merge pull request #56 from jd/pytest
jd May 7, 2019
edecdb3
Add support for Python 3.7, switch to CircleCI
jd May 7, 2019
a80ce6d
Merge pull request #57 from jd/py37
jd May 7, 2019
9e18075
Cleanup CONTRIBUTING
jd May 7, 2019
fc27c72
Switch from pbr to setuptools_scm
jd May 7, 2019
f6fa7c6
Merge pull request #58 from jd/remove-pbr
mergify[bot] May 7, 2019
978a5b7
Report on success to git credential
TristanCacqueray May 8, 2019
1319578
Add git-scm.com link for git credential
TristanCacqueray May 8, 2019
56df851
Name the remote to push with the host type
TristanCacqueray May 8, 2019
c3b6d1a
Discover the clone url of pagure repository
TristanCacqueray May 8, 2019
1301d09
Merge pull request #62 from TristanCacqueray/credential-doc
mergify[bot] May 9, 2019
c8d827b
Merge branch 'master' into 'master'
May 9, 2019
e7b3f7f
Merge pull request #59 from TristanCacqueray/master
mergify[bot] May 9, 2019
6a5a405
Merge branch 'master' into 'git-cred-approve'
May 9, 2019
20694e9
Merge pull request #61 from TristanCacqueray/git-cred-approve
mergify[bot] May 9, 2019
2ab4ad4
Add pagure token documentation
TristanCacqueray May 8, 2019
616a446
Merge pull request #60 from TristanCacqueray/pagure-doc
mergify[bot] May 9, 2019
a0f49fc
Fix setup.cfg field names
jd May 10, 2019
751a142
Allow to only setup the fork repo
sileht Jun 4, 2019
483ac39
Merge pull request #65 from sileht/master
mergify[bot] Jun 4, 2019
a53d2db
get_commit_body: prevent exception when branch name is a filename
TristanCacqueray Jun 4, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
version: 2

jobs:
pep8:
docker:
- image: circleci/python:3.7
steps:
- checkout
- run:
command: |
sudo pip install tox
tox -e pep8
py35:
docker:
- image: circleci/python:3.5
steps:
- checkout
- run:
command: |
sudo pip install tox
tox -e py35
py36:
docker:
- image: circleci/python:3.6
steps:
- checkout
- run:
command: |
sudo pip install tox
tox -e py36
py37:
docker:
- image: circleci/python:3.7
steps:
- checkout
- run:
command: |
sudo pip install tox
tox -e py37


workflows:
version: 2

test:
jobs:
- pep8
- py35
- py36
- py37
23 changes: 21 additions & 2 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,31 @@ pull_request_rules:
- name: automatic merge
conditions:
- base=master
- status-success=continuous-integration/travis-ci/pr
- "status-success=ci/circleci: pep8"
- "status-success=ci/circleci: py35"
- "status-success=ci/circleci: py36"
- "status-success=ci/circleci: py37"
- "#approved-reviews-by>=1"
- label!=work-in-progress
actions:
merge:
strict: "smart"
strict: true
- name: dismiss reviews
conditions: []
actions:
dismiss_reviews: {}
- name: automatic merge no review
conditions:
- base=master
- "status-success=ci/circleci: pep8"
- "status-success=ci/circleci: py35"
- "status-success=ci/circleci: py36"
- "status-success=ci/circleci: py37"
- label=no-review-needed
- label!=work-in-progress
actions:
merge:
strict: true
- name: dismiss reviews
conditions: []
actions:
Expand Down
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

142 changes: 99 additions & 43 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
First off, thanks for taking the time to contribute!

The following as a set of guidelines for contributing to git-pull-request.
These are mostly guidelines, not rules. Use your best judgment, and fell
free to propose changes to this document in a pull request.
These are mostly guidelines, not rules. Use your best judgment, and fell free
to propose changes to this document in a pull request.

## Code of Conduct

This project and everyone participating in it is governed
by the [git-pull-request Code of Conduct](CODE_OF_CONDUCT.md).
By participating, you are expected to uphold this code.
Please report unacceptable behavior to [julien@danjou.info](mailto:julien@danjou.info).
This project and everyone participating in it is governed by the
[git-pull-request Code of Conduct](CODE_OF_CONDUCT.md). By participating, you
are expected to uphold this code. Please report unacceptable behavior to
[jd@mergify.io](mailto:jd@mergify.io).

## How Can I Contribute?

Expand All @@ -21,90 +21,146 @@ This section guides you through submitting a bug report for git-pull-request.
Following these guidelines helps maintainers and the community
understand your report, reproduce the behavior, and find related reports.

Before creating bug reports, please perform a
[cursory search](https://github.com/jd/git-pull-request/issues?q=is%3Aissue%20is%3Aopen%20)
to see if the problem has already been reported.
If it has and the issue is still open, add a comment to
the existing issue instead of opening a new one.
When you are creating a bug report, please [include as many details as possbile](#how-do-i-submit-a-good-bug-report).
Before creating bug reports, please perform a [cursory
search](https://github.com/Mergifyio/git-pull-request/issues?q=is%3Aissue%20is%3Aopen%20)
to see if the problem has already been reported. If it has and the issue is
still open, add a comment to the existing issue instead of opening a new one.
When you are creating a bug report, please [include as many details as
possbile](#how-do-i-submit-a-good-bug-report).

> **Note:** If you find a **Closed** issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.
> **Note:** If you find a **Closed** issue that seems like it is the same thing
> that you're experiencing, open a new issue and include a link to the original
> issue in the body of your new one.

#### How Do I Submit A (Good) Bug Report?

Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/).
Bugs are tracked as [GitHub
issues](https://guides.github.com/features/issues/).

Explain the problem and include additional details to help maintainers reproduce the problem:
Explain the problem and include additional details to help maintainers
reproduce the problem:

* **Use a clear and descriptive title** for the issue to identify the problem.
* **Describe the exact steps which reproduce the problem** in as many details as possible. For example, start by explaining how you use the git-pull-request command line, e.g. which command exactly you used in the terminal. When listing steps, **don't just say what you did, but explain how you did it**.
* **Provide specific examples to demonstrate the steps**. Include links to files or GitHub projects, or copy/pasteable snippets, which you use in those examples. If you're providing snippets in the issue, use [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines).
* **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.

* **Describe the exact steps which reproduce the problem** in as many details
as possible. For example, start by explaining how you use the
git-pull-request command line, e.g. which command exactly you used in the
terminal. When listing steps, **don't just say what you did, but explain how
you did it**.

* **Provide specific examples to demonstrate the steps**. Include links to
files or GitHub projects, or copy/pasteable snippets, which you use in those
examples. If you're providing snippets in the issue, use [Markdown code
blocks](https://help.github.com/articles/markdown-basics/#multiple-lines).

* **Describe the behavior you observed after following the steps** and point
out what exactly is the problem with that behavior.

* **Explain which behavior you expected to see instead and why.**


Provide more context by answering these questions:

* **Did the problem start happening recently** (e.g. after updating to a new version of git-pull-request) or was this always a problem?
* If the problem started happening recently, **can you reproduce the problem in an older version of git-pull-request?** What's the most recent version in which the problem doesn't happen? You can install older versions of git-pull-request from [the pypi repository](https://pypi.python.org/pypi/git-pull-request/).
* **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens.
* **Did the problem start happening recently** (e.g. after updating to a new
version of git-pull-request) or was this always a problem?

* If the problem started happening recently, **can you reproduce the problem in
an older version of git-pull-request?** What's the most recent version in
which the problem doesn't happen? You can install older versions of
git-pull-request from [the pypi
repository](https://pypi.python.org/pypi/git-pull-request/).

* **Can you reliably reproduce the issue?** If not, provide details about how
often the problem happens and under which conditions it normally happens.


Include details about your configuration and environment:

* **Which version of git-pull-request are you using?** You can get the exact version by running `pip freeze | grep "git-pull-request"` in your terminal.
* **Which version of git-pull-request are you using?** You can get the exact
version by running `pip freeze | grep "git-pull-request"` in your terminal.

* **What's the name and version of the OS you're using**?

* **What's the version of python you're using**?

### Suggesting Enhancements

This section guides you through submitting an enhancement suggestion for git-pull-request, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion and find related suggestions.
This section guides you through submitting an enhancement suggestion for
git-pull-request, including completely new features and minor improvements to
existing functionality. Following these guidelines helps maintainers and the
community understand your suggestion and find related suggestions.

When you are creating an enhancement suggestion, please [include as many details as possible](#how-do-i-submit-a-good-enhancement-suggestion) and including the steps that you imagine you would take if the feature you're requesting existed.
When you are creating an enhancement suggestion, please [include as many
details as possible](#how-do-i-submit-a-good-enhancement-suggestion) and
including the steps that you imagine you would take if the feature you're
requesting existed.

#### How Do I Submit A (Good) Enhancement Suggestion?

Enhancement suggestions are tracked as [GitHub issues](https://guides.github.com/features/issues/).
Enhancement suggestions are tracked as [GitHub
issues](https://guides.github.com/features/issues/).

Provide the following information:

* **Use a clear and descriptive title** for the issue to identify the suggestion.
* **Provide a step-by-step description of the suggested enhancement** in as many details as possible.
* **Provide specific examples to demonstrate the steps**. Include copy/pasteable snippets which you use in those examples, as [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines).
* **Describe the current behavior** and **explain which behavior you expected to see instead** and why.
* **Include screenshots and animated GIFs** which help you demonstrate the steps or point out the part of git-pull-request which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux.
* **Explain why this enhancement would be useful** to most git-pull-request users.
* **Use a clear and descriptive title** for the issue to identify the
suggestion.

* **Provide a step-by-step description of the suggested enhancement** in as
many details as possible.

* **Provide specific examples to demonstrate the steps**. Include
copy/pasteable snippets which you use in those examples, as [Markdown code
blocks](https://help.github.com/articles/markdown-basics/#multiple-lines).

* **Describe the current behavior** and **explain which behavior you expected
to see instead** and why.

* **Include screenshots and animated GIFs** which help you demonstrate the
steps or point out the part of git-pull-request which the suggestion is
related to. You can use [this tool](https://www.cockos.com/licecap/) to
record GIFs on macOS and Windows, and [this
tool](https://github.com/colinkeenan/silentcast) or [this
tool](https://github.com/GNOME/byzanz) on Linux.

* **Explain why this enhancement would be useful** to most git-pull-request
users.

* **List some other tools or applications where this enhancement exists.**
* **Specify which version of git-pull-request you're using.** You can get the exact version by running `pip freeze| grep "git-pull-request"` in your terminal.

* **Specify which version of git-pull-request you're using.** You can get the
exact version by running `pip freeze| grep "git-pull-request"` in your
terminal.

* **Specify the name and version of the OS you're using.**

* **Specify the version of python you're using**

## Code Contribution

### Hacking on git-pull-request

If you're hitting a bug in git-pull-request or just want to experiment with adding a feature, follow these steps.
If you're hitting a bug in git-pull-request or just want to experiment with
adding a feature, follow these steps.

#### Prerequisites

- [venv](https://docs.python.org/3/library/venv.html) or consider [pipenv](https://github.com/kennethreitz/pipenv)
- [pbr](https://docs.openstack.org/pbr/latest/)
- python3.5+
- Python >= 3.5

#### Cloning

``` command-line
$ git clone https://github.com/jd/git-pull-request
$ git clone https://github.com/Mergifyio/git-pull-request
```

#### Setup your environment

From there, you can navigate into the directory where you've cloned the git-pull-request source code, create a virtual environment and install all the required dependencies:
From there, you can navigate into the directory where you've cloned the
git-pull-request source code, create a virtual environment and install all the
required dependencies:

``` command-line
$ cd git-pull-request
$ venv .
$ pip install -r requirements.txt
$ python setup.py develop
$ pip install -e .
```

#### Make your changes
Expand All @@ -114,15 +170,15 @@ $ git checkout -b somefeature
<edit files>
$ git commit -am 'I did some changes'
$ git pull-request
Forked repository: https://github.com/jd/git-pull-request
Forked repository: https://github.com/Mergifyio/git-pull-request
Force-pushing branch `somefeature' to remote `github'
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 562 bytes | 0 bytes/s, done.
Total 5 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To https://github.com/jd/git-pull-request.git
To https://github.com/Mergifyio/git-pull-request.git
+ 73a733f7...1be2bf29 somefeature -> somefeature (forced update)
Pull-request created: https://github.com/git-pull-requestxyz/git-pull-request/pull/33
```
Expand Down
39 changes: 23 additions & 16 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,6 @@ Although it might not be up to date with the `latest code on GitHub <https://git

Usage
=====
You need to write your credentials into your `~/.netrc file`. In case you
have 2FA enabled for GitHub, make sure to replace your password by a
`Personal access token <https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/>`_::

machine github.com login jd password f00b4r

For Pagure, you need to create an API key by visiting your `settings <https://pagure.io/settings#api-keys>`_
and requesting the `Fork a project` and `Modify an existing project` ACLs::

machine pagure.io login tristanc password $your-api-token

Note: since credentials are stored in plain text, you should encrypt your `$HOME`
directory to improve security.

Once you've made your commits into a branch, just type::

git pull-request
Expand All @@ -60,6 +46,26 @@ been opened for your current working branch.

Workflow advice
===============

Caching Credentials
-------------------

GitHub has a good documentation about using `git credential
<https://help.github.com/en/articles/caching-your-github-password-in-git>`_.

The full documentation is available on the `git-scm.com website
<https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage>`_.

Pagure Token
------------

Pagure uses API key, you need to create one by visiting `your settings
<https://pagure.io/settings#nav-api-tab>`_
and requesting the `Fork a project` and `Modify an existing project` ACL.

Creating Branches
-----------------

When sending pull-requests, it's preferable to do so from your own branch. You
can create your own branch from `master` by doing::

Expand All @@ -86,8 +92,9 @@ Difference with hub
The wrapper `hub`_ provides `hub fork` and `hub pull-request` as
command line tools to fork and create pull-requests.

Unfortunately, it's hard to combine these tools in an automated implementation for a
complete workflow.
Unfortunately, it's hard to combine these tools in an automated implementation for a
complete workflow.

For example:
If you need to update your pull-request, there's no way to identify existing pull requests, so
calling `hub pull-request` would just open a new pull-request.
Expand Down
Loading