Commit Graph

19 Commits

Author SHA1 Message Date
Martin Liska e247d59274
Add new git-backport.py script.
contrib/ChangeLog:

	* gcc-git-customization.sh: Use git-backport.py to drop
	all changes for ChangeLog files.
	* git-backport.py: New file.
2020-05-27 12:04:57 +02:00
Martin Liska b423f910dc
Rename commit-mklog alias to gcc-commit-mklog.
contrib/ChangeLog:

	* gcc-git-customization.sh: Rename
	commit-mklog to gcc-commit-mklog.
2020-05-27 10:16:21 +02:00
Jason Merrill 757dbb59c1
gcc-git: Add prepare-commit-msg hook.
This patch introduces a prepare-commit-msg hook that appends a ChangeLog
skeleton to a commit message when the GCC_FORCE_MKLOG environment variable
is set, and a 'git commit-mklog' command set that variable while running
'git commit'.

contrib/ChangeLog:

	* prepare-commit-msg: New file.
	* gcc-git-customization.sh: Install it.  Add commit-mklog alias.
	* mklog.py: Add new option -c which appends
	to a ChangeLog file.
2020-05-26 08:38:24 +02:00
Martin Liska 713890935d
Add gcc-backport and support git cherry pick.
* gcc-changelog/git_commit.py: Support cherry pick
	prefix.
	* gcc-changelog/test_email.py: Test it.
	* gcc-changelog/test_patches.txt: Add new patch.
	* gcc-git-customization.sh: Add gcc-backport.
2020-05-20 09:57:05 +02:00
Martin Liska 00243d9a64
New mklog script.
contrib/ChangeLog:

2020-05-15  Martin Liska  <mliska@suse.cz>

	* gcc-git-customization.sh: Add
	alias.gcc-mklog new hook.
	* mklog.py: New file.
	* test_mklog.py: New file.
2020-05-19 11:40:55 +02:00
Martin Liska c3b44e3408
Add gcc-verify alias.
* gcc-git-customization.sh: Add gcc-verify alias
	that uses contrib/gcc-changelog/git_check_commit.py.
2020-05-19 09:19:18 +02:00
Martin Liska fa4aab7f84
Improve svn-rev to search for pattern at line beginning.
* gcc-git-customization.sh: Search for the pattern
	at line beginning only.
2020-04-03 12:30:39 +02:00
Richard Earnshaw 612137e171 contrib: Change 'remote' for personal branches and add branch creation script
Whilst trying to convert the add vendor branch script to work with
personal branches I encountered a minor issue where git would report
ambiguous refs when checking out the new branch.

It turns out that this is because git considers <me>/<topic> to be
ambiguous if both

  refs/heads/<me>/<topic>

and

  refs/remotes/<me>/<topic>

exist in the list of known branches.

Having thought about this a bit, I think the best solution is to adopt
something more like the vendors space and call the remote users/<me>
(this also works better if you want to set up remotes to track other
users branches as well).

So this patch has two parts.

1) It updates gcc-git-customization.sh to set up the new 'remote' and
converts any existing remote and branches tracking that to the new
format
2) It adds a new script to set up a personal branch on the gcc git repository.

	* gcc-git-customization.sh: Use users/<pfx> for the personal remote
	rather than just <pfx>.  Convert any existing personal branches to the
	new remote.
	* git-add-user-branch.sh: New file.
2020-01-24 14:38:16 +00:00
Richard Earnshaw 24b178184f contrib: New remotes structure for vendor and personal refs
The initial structure for vendor and personal branches makes use of
the default remote (normally origin) for the upstream
repository).  Unfortunately, this causes some confusion, especially for
personal branches because a push will not push to the correct upstream
location.  This can be 'fixed' by adding a push refspec for the remote,
but that has the unfortunate consequence of breaking the push.default
behaviour for git push, and it becomes too easy to accidentally commit
something unintended to the main parts of the repository.

To work around this, this patch changes the configuration to use
separate 'remotes' for these additional refs, with one remote for the
personal space and another remote for each vendor's space.  The
personal space is called after the user's preferred branch-space
prefix (default 'me'), the vendor spaces are called
vendors/<vendor-name>.

As far as possible, I've made the script automatically restructure any
existing fetch or push lines that earlier versions of the scripts may
have created - the gcc-git-customization.sh script will convert all
vendor refs that it can find, so it is not necessary to re-add any
vendors you've already added.

You might, however, want to run
  git remote prune <origin>
after running to clean up any stale upstream-refs that might still be
in your local repo, and then
  git fetch vendors/<vendor>
or
  git fetch <me>
to re-populate the remotes/ structures.

Also, for any branch you already have that tracks a personal or vendor
branch upstream, you might need to run
  git config branch.<name>.remote <new-remote>

so that merges and pushes go to the right place (I haven't attempted
to automate this last part).

For vendors, the new structure means that

  git checkout -b <vendor>/<branch> remotes/vendors/<vendor>/<branch>

will correctly set up a remote tracking branch.

Please be aware that if you have multiple personal branches set up, then

  git push <me>

will still consider all of them for pushing.  If you only want to push
one branch, then either write
  git push <me> HEAD
or
  git push <me> <me>/branch
as appropriate.

And don't forget '-n' (--dry-run) to see what would be done if this
were not a dry run.

Finally, now that the vendors spaces are isolated from each other and
from the other spaces, I've added an option "--enable-push" to
git-fetch-vendor.sh.  If passed, then a "push" spec will be added for
that vendor to enable pushing to the upstream.  If you re-run the
script for the same vendor without the option, the push spec will be
removed.

	* gcc-git-customization.sh: Check that user-supplied remote
	name exists before continuting.  Use a separate remotes for the
	personal commit area.  Convert existing personal and vendor
	fetch rules to new layout.
	* git-fetch-vendor.sh: New vendor layout.  Add --enable-push
	option.
2020-01-20 10:37:29 +00:00
Andreas Schwab 7aa4e0db95 gcc-git-customization.sh: avoid double expansion 2020-01-16 15:48:31 +01:00
Richard Earnshaw 545f5fad17 contrib: Check and if needed set user.name and user.email in gcc-git-customization.sh
As discussed on IRC, this adds a couple more checks in the
customization setup for git.  If the variables user.name and
user.email are not set anywhere in the git config hierarchy, we set
some local values.  We always ask about the values we detect and if
the user gives an answer that is new, we save that in the local
config: this gives the opportunity to use different values to those
configured for the global space.

Also cleaned up a couple of minor niggles, such as using $(cmd) rather
than `cmd` for subshells and some quoting issues when using eval.

	* gcc-git-customization.sh: Check that user.name and user.email
	are set.  Use $(cmd) instead of `cmd`.  Fix variable quoting when
	using eval.
2020-01-16 13:48:37 +00:00
Jakub Jelinek 2588197b6c contrib: Verify the id to be printed is ancestor of the corresponding remote release branch (or master), otherwise print nothing.
The monotonically increasing revision ids need to be globally unique, so they should
only identify commits that were committed to the upstream repo to its master or
releases/gcc-N branches.  The alias could print something even for private branches
or vendor branches etc., but if such an identifier is then used publicly, it will
refer to something else.

2020-01-16  Jakub Jelinek  <jakub@redhat.com>

	* gcc-git-customization.sh: Verify the id to be printed is ancestor of
	the corresponding remote release branch (or master), otherwise print
	nothing.
2020-01-16 12:36:22 +01:00
Jakub Jelinek affb7b66aa Add *.md diff=md.
2020-01-15  Segher Boessenkool  <segher@kernel.crashing.org>
	    Jakub Jelinek  <jakub@redhat.com>

	* .gitattributes: Add *.md diff=md.
contrib/
	* gcc-git-customization.sh: Change uses to use in comment.
2020-01-15 14:29:53 +01:00
Jakub Jelinek 6ff7efb737 Handle output of older git in gcc-descr and gcc-undescr aliases. 2020-01-15 12:35:22 +01:00
Richard Earnshaw e61074228d contrib: Don't add push rules for personal and vendor spaces.
Originally, it seemed like a good idea to add automatic 'push' rules
to the git configuration, so that personal- and vendor-space commits
would automatically push to the right place.  Unfortunately, this
changes git's behaviour and with these settings "git push" will try to
push all branches in a local tree up to the corresponding location on
the server (ignoring the push.default setting).  The only known
mitigation for this is to ALWAYS use "git push <server> <branch>".

So instead, we no-longer add those rules by default and will document
the options on the wiki.  We don't automatically remove the push
entries but do print out the command that will do so, if the user so
wishes.

	* gcc-git-customization.sh: Explain why we want the user's
	upstream account name.  Don't add push rules.  Check if push rules
	have been added and suggest that they should be removed.
	* git-fetch-vendor.sh: Don't add push rules.
2020-01-15 11:31:29 +00:00
Richard Earnshaw 11b81575c5 Revert "contrib: Add in the default push rule which was overridden"
This reverts commit b60563a8bf.

Doesn't work as expected.
2020-01-13 18:43:28 +00:00
Richard Earnshaw b60563a8bf contrib: Add in the default push rule which was overridden
When we add a push rule, the default rule gets removed, so add that in
explicitly.  This needs to come last since otherwise it would match
the custom redirecting rules we have for personal and vendor
sub-spaces.

I also noticed that the push rule for the vendor subspace still had
a force push default.  We don't want that so remove it.

	* gcc-git-customization.sh: Add back the default rule that
	is lost by adding a custom push rule.
	* git-fetch-vendor.sh: Likewise, also remove '+' from push specs.
2020-01-13 18:26:18 +00:00
Jakub Jelinek e19db6a2f7 contrib: Add git gcc-descr and gcc-undescr aliases.
2020-01-13  Jakub Jelinek  <jakub@redhat.com>

	* contrib/gcc-git-customization.sh: Add git gcc-descr and gcc-undescr
	aliases.
2020-01-13 15:15:17 +01:00
Richard Earnshaw 743d4d827b contrib: Add script to help with customizing a git checkout for use with GCC
This patch is intended to help with folks setting up a git work
environment for use with GCC following the transition to git.  It
currently does a couple of things.

1) Add an alias 'svn-rev' to git so that you can look up a legacy
commit by its svn revision number.  This enables you to type
	git svn-rev 1234
and git will show the commit log entry relating to SVN r1234.

2) Sets up tracking information for the user's personal area in
the git repo.  It tries to figure out some sensible answers to the
data it needs, but allows the user to override the values.  It then
creates the fetch and push entries that are needed for tracking the
extra refs. This implements one part of the recommendations that I've
proposed in svnwrite.html for dealing with private branches.

It should be possible to run the script more than once and for it to
DTRT.  If you change your answers the configuration should be
correctly updated.

2020-01-13  Richard Earnshaw  <rearnsha@arm.com>

    * gcc-git-customization: New file.
2020-01-13 13:40:23 +00:00