summaryrefslogtreecommitdiffstats
path: root/tools/patman/gitutil.py
Commit message (Collapse)AuthorAgeFilesLines
* buildman: Allow branch names which conflict with directoriesSimon Glass2016-03-171-0/+5
| | | | | | | | | | At present if you try to use buildman with the branch 'test' it will complain that it is unsure whether you mean the branch or the directory. This is a feature of the 'git log' command that buildman uses. Fix it by resolving the ambiguity. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* patman: Add --thread optionMateusz Kulikowski2016-01-201-1/+5
| | | | | | | | | | | | | | Add option to create threaded series of patches. With it, it will be possible to create patch threads like this: [PATCH 0/10] Add support for time travel [PATCH 1/10] Add Flux Capacitor driver [PATCH 2/10] Add Mr. Fusion driver (...) Internally it will call git send-email with --thread option Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
* Revert "patman: use -D option for git format-patch"Masahiro Yamada2015-09-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | This reverts commit 19b4a3369876f9215e2b861f211e8df1a75e26ca. Since that commit, patman generates useless patches for file removal; "git format -D" prints only the header but not the diff when deleting files, and "git am" always refuses such patches. The following is the quotation from "man git-format-patch": -D, --irreversible-delete Omit the preimage for deletes, i.e. print only the header but not the diff between the preimage and /dev/null. The resulting patch is not meant to be applied with patch nor git apply; this is solely for people who want to just concentrate on reviewing the text after the change. In addition, the output obviously lack enough information to apply such a patch in reverse, even manually, hence the name of the option. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Simon Glass <sjg@chromium.org>
* patman: use -D option for git format-patchMasahiro Yamada2015-08-261-1/+1
| | | | | | | | This allows Patman to generate smaller patches for file removal. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
* patman: check git format.subjectprefix setting when generate patches prefixWu, Josh2015-04-231-0/+11
| | | | | | | | | | | | | | For the local project, we may specified format.subjectprefix setting. Then the patch will be formated as [Project_prefix][PATCH]. But patman will not check this setting. It will remove the format.subjectprefix. So This patch will let patman check this setting and add it as a project prefix. Signed-off-by: Josh Wu <josh.wu@atmel.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* buildman: Fix incorrect arguemnt in GetUpstream()Simon Glass2015-02-151-1/+1
| | | | | | | | This causes an error when trying to build a local branch which has a local branch as its upstream. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
* patman: Make dry-run output match real functionalityPeter Tyser2015-01-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | When run with the --dry-run argument patman prints out information showing what it would do. This information currently doesn't line up with what patman/git send-email really do. Some basic examples: - If an email address is addressed via "Series-cc" and "Patch-cc" patman shows that email address would be CC-ed two times. - If an email address is addressed via "Series-to" and "Patch-cc" patman shows that email address would be sent TO and CC-ed. - If an email address is addressed from a combination of tag aliases, get_maintainer.pl output, "Series-cc", "Patch-cc", etc patman shows that the email address would be CC-ed multiple times. Patman currently does try to send duplicate emails like the --dry-run output shows, but "git send-email" intelligently removes duplicate addresses so this patch shouldn't change the non-dry-run functionality. Change patman's output and email addressing to line up with the "git send-email" logic. This trims down patman's dry-run output and prevents confusion about what patman will do when emails are actually sent. Signed-off-by: Peter Tyser <ptyser@xes-inc.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* buildman: Allow specifying a range of commits to buildSimon Glass2015-01-141-5/+19
| | | | | | | | Adjust the -b flag to permit a range expression as well as a branch. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
* buildman: Try to guess the upstream commitSimon Glass2015-01-141-9/+59
| | | | | | | | | | | | | | | Buildman normally obtains the upstream commit by asking git. Provided that the branch was created with 'git checkout -b <branch> <some_upstream>' then this normally works. When there is no upstream, we can try to guess one, by looking up through the commits until we find a branch. Add a function to try this and print a warning if buildman ends up relying on it. Also update the documentation to match. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Wolfgang Denk <wd@denx.de>
* patman: RunPipe() should not pipe stdout/stderr unless askedSimon Glass2014-09-091-3/+5
| | | | | | | RunPipe() currently pipes the output of stdout and stderr to a pty, but this is not the intended behaviour. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Fix detection of git versionSimon Glass2014-09-051-0/+2
| | | | | | | A missing 'global' declaration means that this feature does not currently work. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Use --no-pager' to stop git from forking a pagerSimon Glass2014-09-051-1/+1
| | | | | | | | In a headless environment the pager can apparently hang. We don't want a pager anyway so let's request that none be used. Reported-by: Tom Rini <trini@ti.com> Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Remove the -a optionSimon Glass2014-09-051-88/+0
| | | | | | | | | It seems that this is no longer needed, since checkpatch.pl will catch whitespace problems in patches. Also the option is not widely used, so it seems safe to just remove it. Suggested-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Correct unit tests to run correctlySimon Glass2014-09-051-4/+4
| | | | | | | | | | It seems that doctest behaves differently now, and some of the unit tests do not run. Adjust the tests to work correctly. ./tools/patman/patman --test <unittest.result.TestResult run=10 errors=0 failures=0> Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Support the 'reverse' option for 'git log'Simon Glass2014-08-281-0/+2
| | | | | | | | This option is currently not supported, but needs to be, for buildman to operate as expected. Reported-by: York Sun <yorksun@freescale.com> Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Only use git's --no-decorate when availableSimon Glass2014-08-131-1/+8
| | | | | | | | Older versions of git (e.g. Ubuntu 10.04) do not support this flag. By default they do not decorate. So only enable this flag when supported. Suggested-by: Tom Rini <trini@ti.com> Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Move the 'git log' command into a functionSimon Glass2014-08-131-5/+28
| | | | | | | Move the code that builds a 'git log' command into a function so we can more easily adjust it. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: make "No recipient" checking more tolerantMasahiro Yamada2014-07-281-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | If Series-to tag is missing, Patman exits with a message "No recipient". This is just annoying for those who had already added sendemail.to configuration. I guess many developers have [sendemail] to = u-boot@lists.denx.de in their .git/config because the 'To: u-boot@lists.denx.de' field should always be added when sending patches. That seems more reasonable rather than adding 'Series-to: u-boot@lists.denx.de' to every patch series. Patman should exit only when both Series-to tag and sendemail.to configuration are mising. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
* patman: Only apply patches when we know the original HEADSimon Glass2014-07-071-0/+4
| | | | | | | | | | | | | | When patman applies the patches it checks out a new branch, uses 'git am' to apply the patches one by one, and then tries to go back to the old branch. If you try this when the branch is 'undefined', this doesn't work as patman cannot restore the correct branch after applying the patches. It seems that 'undefined' is created by git and is persistent after it is created, so that you can end up on quite an old branch. Add a check for the 'undefined' branch to avoid this. Reported-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Deal with 'git apply' failures correctlySimon Glass2014-05-091-2/+4
| | | | | | | This sort of failure is rare, but the code to deal with it is wrong. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
* Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-241-17/+1
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* buildman: Produce a sensible error message when branch is missingSimon Glass2013-05-141-6/+15
| | | | | | | Rather than a backtrace, produce a nice error message when an invalid branch is provided to buildman. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: fix gitutil for decorationsAndreas Bießmann2013-04-181-3/+5
| | | | | | | | | The git config parameter log.decorate is quite useful when working with git. Patman, however can not handle the decorated output when parsing the commit. To prevent this use the '--no-decorate' switch for git-log. Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> Acked-by: Simon Glass <sjg@chromium.org>
* patman: Provide option to ignore bad aliasesSimon Glass2013-04-081-18/+47
| | | | | | | | | | | | | | | Often it happens that patches include tags which don't have aliases. It is annoying that patman fails in this case, and provides no option to continue other than adding empty tags to the .patman file. Correct this by adding a '-t' option to ignore tags that don't exist. Print a warning instead. Since running the tests is not a common operation, move this to --test instead, to reserve -t for this new option. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Doug Anderson <dianders@chromium.org>
* patman: Allow specifying the message ID your series is in reply toDoug Anderson2013-04-041-1/+6
| | | | | | | | | Some versions of git don't seem to prompt you for the message ID that your series is in reply to. Allow specifying this from the command line. Signed-off-by: Doug Anderson <dianders@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
* patman: Add additional git utiltiesSimon Glass2013-04-041-1/+123
| | | | | | | Add methods to find out the commits in a branch, clone a repo and fetch from a repo. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Allow commands to raise on error, or notSimon Glass2013-04-041-1/+2
| | | | | | | | Make raise_on_error a parameter so that we can control which commands raise and which do not. If we get an error reading the alias file, just continue. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Make command methods return a CommandResultSimon Glass2013-04-041-1/+1
| | | | | | | | Rather than returning a list of things, return an object. That makes it easier to access the returned items, and easier to extend the return value later. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Add support for settings in .patmanDoug Anderson2013-01-311-2/+0
| | | | | | | | | | | | | | | | | | | | | | This patch adds support for a [settings] section in the .patman file. In this section you can add settings that will affect the default values for command-line options. Support is added in a generic way such that any setting can be updated by just referring to the "dest" of the option that is passed to the option parser. At the moment options that would make sense to put in settings are "ignore_errors", "process_tags", and "verbose". You could override them like: [settings] ignore_errors: True process_tags: False verbose: True The settings functionality is also used in a future change which adds support for per-project settings. Signed-off-by: Doug Anderson <dianders@chromium.org>
* patman: Allow tests to run even if patman is in the pathDoug Anderson2013-01-311-2/+9
| | | | | | | | | | | Several of the patman doctests assume that patman was run with: ./patman Fix them so that they work even if patman is run with just "patman" (because patman is in the path). Signed-off-by: Doug Anderson <dianders@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
* patman: force git log commands to not use colorAlbert ARIBAUD2012-10-191-1/+1
| | | | | | | | | | Colored logs confuse patman when analyzing logs. Add --no-color option in git log commands in case the default config has color. Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net> Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@ti.com>
* patman: Handle creation of patman config fileVikram Narayanan2012-06-191-0/+18
| | | | | | | | | | | | | patman shouts when it couldn't find a $(HOME)/.patman file. Handle it in a sane way by creating a new one for the user. It looks for a user.name and user.email in the global .gitconfig file, waits for the user input if it can't find there. Update the same in the README Signed-off-by: Vikram Narayanan <vikram186@gmail.com> Acked-by: Simon Glass <sjg@chromium.org> Cc: Simon Glass <sjg@chromium.org> Cc: Wolfgang Denk <wd@denx.de>
* Add 'patman' patch generation, checking and submission scriptSimon Glass2012-04-211-0/+372
What is this? ============= This tool is a Python script which: - Creates patch directly from your branch - Cleans them up by removing unwanted tags - Inserts a cover letter with change lists - Runs the patches through checkpatch.pl and its own checks - Optionally emails them out to selected people It is intended to automate patch creation and make it a less error-prone process. It is useful for U-Boot and Linux work so far, since it uses the checkpatch.pl script. It is configured almost entirely by tags it finds in your commits. This means that you can work on a number of different branches at once, and keep the settings with each branch rather than having to git format-patch, git send-email, etc. with the correct parameters each time. So for example if you put: in one of your commits, the series will be sent there. See the README file for full details. END Signed-off-by: Simon Glass <sjg@chromium.org>
OpenPOWER on IntegriCloud