1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

33 Commits

Author SHA1 Message Date
Jordan Rupprecht
4106506993 [git] Be more specific when looking for llvm-svn
Summary:
A commit may, for some reason, have `llvm-svn:` in it multiple times. It may even take up the whole line and look identical to what gets added automatically when svn commits land in github.

To workaround this, make changes to both lookups:

1) When doing the git -> svn lookup, make sure to go through the whole message, and:
 a) Only look for llvm-svn starting at the beginning of the line (excluding the whitespace that `git log` adds).
 b) Take the last one (at the end of the commit message), if there are multiple matches.

2) When doing the svn -> git lookup, look through a sizeable but still reasonably small number of git commits (10k, about 4-5 months right now), and:
 a) Only consider commits with the '^llvm-svn: NNNNNN' we expect, and
 b) Only consider those that also follow the same git -> svn matching above. (Error if it's not exactly one commit).

Reviewers: jyknight

Reviewed By: jyknight

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D60017

llvm-svn: 361532
2019-05-23 18:43:19 +00:00
Craig Topper
09db3b5d76 Make the git-llvm script work on older git versions that don't support git rev-parse --git-common-dir.
Not all versions of git support git rev-parse --git-common-dir. Rather than erorr or print any kind of
useful error, they just print back '--git-common-dir' instead of a directory. The git-llvm script
ends up taking this '--git-common-dir' as a diretory name to use.

Not sure exactly what happens after that, but the end result is that the 'git llvm push' ends up
looking like it pushed your commits, but really did nothing.

This patch makes the script detect the bogus directory name for --git-common-dir and falls back to using --git-dir instead.

llvm-svn: 359939
2019-05-03 22:03:29 +00:00
Jordan Rupprecht
f0db1c1b78 Add "git llvm revert" and "git llvm svn-lookup" subcommands
Summary:
The current git-svnrevert script only works with git-svn repos (e.g. using "git svn find-rev" to find the commit to revert). This adds a similar implementation that works with the llvm git command handler.

Usage:
```
// Revert by svn id
$ git llvm revert r123456
// See what commands would be run instead of actually reverting
$ git llvm revert -n r123456
<full git revert + git commit commands>
// Git commit hash also fine
$ git llvm revert abc123456
// For convenience, the git->svn method can be used directly:
$ git llvm svn-lookup abc123456
r123456
// Push revert upstream (drop the -n when ready)
$ git llvm push -n
```

Regardless of how the command is invoked (with a svn revision or git hash), the message is:

```
Revert [LibFoo] Change Foo implementation

This reverts r123456 (git commit abc123)
```

Reviewers: jyknight, mehdi_amini, jlebar

Reviewed By: jlebar

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D59837

llvm-svn: 357180
2019-03-28 16:15:28 +00:00
Raphael Isemann
bfaa497048 Fix git-llvm crashing when trying to remove directory while cleaning
Summary:
I'm trying to push D59198 but it seems that `git-llvm push` can't handle the fact
that I add a new directory in the patch:

```
> git llvm push -n
Pushing 1 commit:
  e7c0a9bd136 Correctly look up declarations in inline namespaces
Traceback (most recent call last):
  File "llvm/utils/git-svn//git-llvm", line 431, in <module>
    args.func(args)
  File "llvm/utils/git-svn//git-llvm", line 385, in cmd_push
    clean_svn(svn_root)
  File "llvm/utils/git-svn//git-llvm", line 201, in clean_svn
    os.remove(os.path.join(svn_repo, filename))
IsADirectoryError: [Errno 21] Is a directory: '.git/llvm-upstream-svn/lldb/trunk/packages/Python/lldbsuite/test/expression_command/inline-namespace'
```

This patch just uses shutil to delete the directory instead of trying to use `os.remove`
which only works for files.

Reviewers: mehdi_amini, jlebar

Reviewed By: jlebar

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D59236

llvm-svn: 355896
2019-03-12 07:40:54 +00:00
Shoaib Meenai
790f1df49a [git-llvm] Only use --force-interactive when supported
The --force-interactive option was introduced in SVN 1.8, and trying to
pass it to older SVN clients causes an error; CentOS 7 includes SVN 1.7,
for example, so this makes `git llvm` not usable out of the box. Older
clients would be interactive by default anyway [1], so just don't pass
the option if it's not supported.

An alternative would be to check the version instead of checking the
help text, but I think directly detecting the presence of the option is
more direct.

[1] http://svn.apache.org/viewvc?view=revision&revision=1424037

Differential Revision: https://reviews.llvm.org/D59161

llvm-svn: 355782
2019-03-10 01:34:42 +00:00
Chandler Carruth
ae65e281f3 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00
James Y Knight
17ff4d329f git-llvm: Fix incremental population of svn tree.
"svn update --depth=..." is, annoyingly, not a specification of the
desired depth, but rather a _limit_ added on top of the "sticky" depth
in the working-directory. However, if the directory doesn't exist yet,
then it sets the sticky depth of the new directory entries.

Unfortunately, the svn command-line has no way of expanding the depth
of a directory from "empty" to "files", without also removing any
already-expanded subdirectories. The way you're supposed to increase
the depth of an existing directory is via --set-depth, but
--set-depth=files will also remove any subdirs which were already
requested.

This change avoids getting into the state of ever needing to increase
the depth of an existing directory from "empty" to "files" in the
first place, by:

1. Use svn update --depth=files, not --depth=immediates.

The latter has the effect of checking out the subdirectories and
marking them as depth=empty. The former excludes sub-directories from
the list of entries, which avoids the problem.

2. Explicitly populate missing parent directories.

Using --parents seemed nice and easy, but it marks the parent dirs as
depth=empty. Instead, check out parents explicitly if they're missing.

llvm-svn: 347883
2018-11-29 16:46:34 +00:00
James Y Knight
9c482c4eb0 llvm-git: More tweaks.
On python3, use bytes for reading and applying the patch file, rather
than str. This fixes encoding issues when applying patches with
python3.X (reported by zturner).

Also, simplify and speed up "svn update" via svn's "--parents"
argument, instead of manually computing and supplying the list of
parent directories to update.

llvm-svn: 347766
2018-11-28 15:30:39 +00:00
James Y Knight
d25837ed5d Make git-llvm python3 compatible again. Hopefully. :)
llvm-svn: 347113
2018-11-16 23:59:23 +00:00
James Y Knight
a089eed482 Speed up git-llvm script by only svn up'ing affected directories.
Also, support modifications to toplevel files in git (which need to be
committed to "monorepo-root" in svn).

Differential Revision: https://reviews.llvm.org/D54341

llvm-svn: 347103
2018-11-16 22:36:17 +00:00
Zachary Turner
aa4a00c53a [git-llvm] Fix some issues surrouding EOL conversion on Windows.
This patch fixes three issues.

The first is that we didn't consider files which are explicitly
set to eolstyle CRLF in the repo, and there are a handful of
these.

Second is that dos2unix doesn't have a -q option in GnuWin32,
so this codepath wasn't working properly.

Finally with newer versions of Python (or newer versions of Git,
or some combination of the two) patches can't be applied when
we treat stdin as text, because Python silently undoes all the
work we did to convert the newlines to LF using dos2unix by
using universal_newlines=True and then converting them *back*
to CRLF.  So we need to add a way to force stdin to be treated
as binary, and use it when LF-newlines are required.

Differential Revision: https://reviews.llvm.org/D51444

llvm-svn: 344095
2018-10-09 23:42:28 +00:00
Walter Lee
1392978da7 [git-llvm] Handle files ignored by svn correctly
Summary: Correctly handle files ignored by svn (such as .o files,
which are ignored by default) by adding "--no-ignore" flag to "svn
status" and "svn add".

Differential Revision: https://reviews.llvm.org/D41404

llvm-svn: 321388
2017-12-22 21:19:13 +00:00
Chandler Carruth
87be303362 [git] Update the llvm git helper script to work correctly with the
latest Python versions.

llvm-svn: 313435
2017-09-16 02:13:35 +00:00
Peter Collingbourne
3b89f3ca38 Revert r305598, "utils: Add a git-r utility for mapping svn revisions to git revisions in the monorepo."
$ git revert `git r 305598`

We need to decide whether we want development tools to be written in
Go first.

llvm-svn: 305741
2017-06-19 20:43:09 +00:00
Peter Collingbourne
ab0bdae718 utils: Add a git-r utility for mapping svn revisions to git revisions in the monorepo.
llvm-svn: 305598
2017-06-16 22:15:18 +00:00
Peter Collingbourne
c3802e1e28 git-llvm: Update the project list for the llvm-project-20170507 monorepo.
llvm-svn: 304691
2017-06-04 22:18:57 +00:00
Zachary Turner
b94565d13f git-llvm script should add .exe on Windows.
llvm-svn: 303708
2017-05-24 00:28:46 +00:00
Rui Ueyama
647132cc23 [git-llvm] Check if svn is installed.
The error message that git-llvm script prints out when svn is missing
is very cryptic. I spent a fair amount of time to find what was wrong
with my environment. It looks like many newcomers also exprienced a
hard time to submit their first patches due to this error.

This patch adds a more user-friendly error message.

Differential Revision: https://reviews.llvm.org/D33458

llvm-svn: 303696
2017-05-23 21:50:40 +00:00
Reid Kleckner
e884ef11f4 [git-llvm] Don't attempt to propget files that don't exist yet in SVN
svn propget will fail halfway through, and the patch will fail to apply.

llvm-svn: 303359
2017-05-18 17:17:17 +00:00
Reid Kleckner
871641ed3e [git-llvm] Fix svn:eol-style issue for one-file patches
llvm-svn: 302853
2017-05-12 00:10:19 +00:00
Reid Kleckner
e85c337531 [git-llvm] Remove CR from middle of svn propget output
llvm-svn: 301268
2017-04-24 22:26:46 +00:00
Reid Kleckner
3fae156486 [git-llvm] Make push work on CRLF files with svn:eol-style=native
Summary:
`git apply` on Windows doesn't work for files that SVN checks out as
CRLF. There is no way to force SVN to check everything out with Unix
line endings on Windows. Files with svn:eol-style=native will always
come out with CRLF, breaking `git apply`, which wants Unix line endings.
My workaround is to list all files with this property set in the change,
and run `dos2unix` on them. SVN doesn't commit a massive line ending
change because the svn:eol-style property indicates that these are text
files.

Tested on r301245.

Reviewers: zturner, jlebar

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D32452

llvm-svn: 301262
2017-04-24 22:09:08 +00:00
Rui Ueyama
494d0bced2 Remove extraneous space.
llvm-svn: 290165
2016-12-20 05:49:56 +00:00
Mehdi Amini
8b7ab68531 [git-llvm] Use --force-interactive when commiting to enable SVN to prompt password
When svn does not know the password and it has to prompt, it needs to query.
However it won't when invoked from the Python script and instead fails with:

svn: E215004: Authentication failed and interactive prompting is disabled; see the --force-interactive option

Differential Revision: https://reviews.llvm.org/D27274

llvm-svn: 288266
2016-11-30 19:12:53 +00:00
Mehdi Amini
e56043cb3d Improve git llvm push to suggest git pull when applying patch fails
Differential Revision: https://reviews.llvm.org/D26565

llvm-svn: 286695
2016-11-12 01:17:59 +00:00
Mehdi Amini
96bf571dea Fix git-llvm script to handle git worktree setups correctly
llvm-svn: 286140
2016-11-07 20:35:02 +00:00
Mehdi Amini
d3832fef63 Add some facilities to work with a git monorepo (experimental setup)
Add a new script in llvm/utils/git-svn/. When present in the $PATH,
it enables a `git llvm` command. It is providing at this
point only the ability to push from the git monorepo: `git llvm push`.
It is intended to evolves with more features, for instance I plan on
features like `git llvm show r284955` to help working with sequential
revision numbers.
The push feature is taken from Justin Lebar's script available here:
https://github.com/jlebar/llvm-repo-tools/

Differential Revision: https://reviews.llvm.org/D26334

llvm-svn: 286138
2016-11-07 20:00:47 +00:00
Mehdi Amini
296f7ccf4f Revert "Add some facilities to work with a git monorepo (experimental setup)"
This reverts commit r286123, accidentally commited while testing itself...

llvm-svn: 286124
2016-11-07 17:43:08 +00:00
Mehdi Amini
aab2cc8976 Add some facilities to work with a git monorepo (experimental setup)
Summary:
Some changes are made to cmake, especially the addition of a new
LLVM_ENABLE_PROJECTS option that makes the build system aware of
the monorepo directory structure.

Also a new script is added in llvm/utils/git-svn/. When present in
the $PATH, it enables a `git llvm` command. It is providing at this
point only the ability to push from the git monorepo: `git llvm push`.
It is intended to evolves with more features, for instance I plan on
features like `git llvm show r284955` to help working with sequential
revision numbers.
The push feature is taken from Justin Lebar's script available here:
https://github.com/jlebar/llvm-repo-tools/

Reviewers: jlebar

Subscribers: mgorny, modocache, llvm-commits

Differential Revision: https://reviews.llvm.org/D26334

llvm-svn: 286123
2016-11-07 17:40:28 +00:00
Renato Golin
c87f190902 Improve check on git-svnrevert, better error message
When the commit is not in the tree at all, find-rev returns 0
and prints an empty string. We need to catch that problem too,
when trying to revert.

Adding a list of possible problems, so that you can easily and
quickly correct without having to edit the script again.

llvm-svn: 237516
2015-05-16 10:23:48 +00:00
Renato Golin
cfffbc9054 Update git-svnrevert to accept git and svn revisions
Interchangeable commit ids can now be used on this git-svnrevert, which
will figure out what kind of commit that is (if you use format rNNNN for SVN
commits) and make sure the right ids are used in the right places.

It's a little bit more robust and user-friendly.

llvm-svn: 219290
2014-10-08 09:32:47 +00:00
Michael Gottesman
2188c467aa Use 'git svn find-rev' in git-svnrevert instead of shell script fu.
Thanks Chandler!

llvm-svn: 180592
2013-04-26 03:27:39 +00:00
Michael Gottesman
27f2ffe478 Added the scripts git-svnup/git-svnrevert to utils/git-svn.
It makes more sense to have git-svnup here than catting said file in the
documentation (where we should rather point users to this directory).
I included git-svnrevert as an additional gift to the community. I will update
the documentation in a second commit later today.

git-svnrevert takes in a git hash for a commit, looks up the svn revision for
said commit and then creates the normal git revert commit message with the one
liner message, except instead of saying

  Revert "<<<INSERT ONELINER HERE>>>"

  This reverts commit <<<INSERT GITHASH HERE>>>

It says:

  Revert "<<<INSERT ONELINER HERE>>>"

  This reverts commit r<<<INSERT SVN REVISION HERE>>>

so git hashes will not escape into our svn logs (which just look unseemly).

llvm-svn: 180587
2013-04-26 00:58:45 +00:00