vrajat / git-patch Goto Github PK
View Code? Open in Web Editor NEWA git module to manage open source forks
License: Apache License 2.0
A git module to manage open source forks
License: Apache License 2.0
A common requirement is to edit a patch because of a conflict or other errors. The command line should be:
git patch begin-edit --id --branch # To start edit
git patch complete-edit
The script should implement the following workflow:
dev-branch
complete-edit
complete-edit
will regenerate and replace the patch.begin-edit
and complete-edit
will store any metadata in .patch/cmd_state.yml
. Logs will be stored in .patch/edit-<timestamp>.log
For e.g.
git patch create-branch --help
usage: git-patch create-branch [-h] [-n NAME] [-r REMOTE]
optional arguments:
-h, --help show this help message and exit
-n NAME, --name NAME Name of branch
-r REMOTE, --remote REMOTE
Name of Git Remote
Patches can be combined esp. if they belong to the same feature or module. A subsequent patch maybe a bug fix which doesnt have to be maintained separately.
Currently we begin the patching by downloading latest commit from master. Then we manually resolve conflicts in an iterative fashion. In each iteration we expect to resume from the patch we manually fixed last time. This desired behaviour degrades when master has an update at the later point of time and is in conflict with one of the earlier patches. This can repeatedly break in-progress patch work making user go back and forth.
Hack:
To make this more productive, we can have a pre-processing step wherein you cut the upstream master branch at a certain commit and have that serve as a master for the next steps. With this change, we will only move forward while fixing patches and things remain more clear. The downside of-course is that we miss the commits introduced after the cut.
Patches can be naturally clubbed together. For e.g. the first patch contains a feature and there are subsequent bugs or feature enhancements. If these commits are classified into sections, then they can be managed together esp. w.r.t skipping or to compact them into a single commit. Provide a couple of functions to manage patches and sections:
After using 'git patch fix-patch' the fixed patch changes author of the fix to the person fixing the patch.
This makes it harder to track down who did what through git blame.
The workflow to fix conflicts is cumbersome. Conflicts are identified by running git patch apply
. Then the branch has to be recreated and patches applied. Instead allow developers to edit conflicts when apply
command detects conflicts.
Traceback (most recent call last):
File "/Users/rajatv/qubole_src/presto_env/bin/git-patch", line 11, in
sys.exit(main())
File "/Users/rajatv/qubole_src/presto_env/lib/python2.6/site-packages/git_patch/git_patch.py", line 290, in main
argument.func(argument, patches)
File "/Users/rajatv/qubole_src/presto_env/lib/python2.6/site-packages/git_patch/git_patch.py", line 135, in patch_apply
section_apply(args, patches)
File "/Users/rajatv/qubole_src/presto_env/lib/python2.6/site-packages/git_patch/git_patch.py", line 167, in section_apply
if commit == os.path.basename(args.patch):
File "/Users/rajatv/qubole_src/presto_env/lib/python2.6/posixpath.py", line 111, in basename
i = p.rfind('/') + 1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.