Skip to content

Interested in pulling in major rewrite? #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2441ccf
First step at creating 'git-svn-ext'
wberrier May 25, 2012
ae1c64d
incorporate git-svn-externals-check as "git-svn-ext check"
wberrier May 25, 2012
4809fd9
collapse git-svn-externals-update into: git-svn-ext update
wberrier May 25, 2012
1a22161
fold git-svn-clone-externals into git-svn-ext
wberrier Jun 13, 2012
fe383fe
force "check" to be run from the root of a repo and only run against …
wberrier May 25, 2012
9476322
consolidate some code to iterate through the externals
wberrier May 26, 2012
34d932a
abstract out .git_externals string
wberrier May 26, 2012
60b1ab4
add for_all handler: runs a command against all externals
wberrier May 26, 2012
013d56b
for-all: require a command
wberrier May 26, 2012
99c3a47
fix up help system by using a handler class to keep handler ordering …
wberrier May 26, 2012
60e40c2
fix when externals are pinned to a revision for clone and update
wberrier May 26, 2012
ab0d35a
refactor, modularize, and reorganize. also support more external url …
wberrier May 27, 2012
b6aa6b4
Update README.txt
wberrier Jun 13, 2012
46a8a56
Use subprocess to reimplement getoutput instead of commands.getoutput
wberrier Jun 15, 2012
9f030b4
Updates regular expressions for additional svn-external formats
rockeyca Apr 3, 2017
1d6d6a5
Handle parent directories for output symlink directories
rockeyca Apr 3, 2017
ce9f57c
Merge pull request #1 from rockeyca/re_format
wberrier Apr 5, 2017
42cbf88
Merge pull request #2 from rockeyca/parent_dirs
wberrier Apr 5, 2017
4143f60
chore: converting to python3
lepommosaure Jan 23, 2025
9ced4f7
fix: removing debug print
lepommosaure Jan 23, 2025
44e6dca
Merge pull request #3 from lepommosaure/master
wberrier Jan 25, 2025
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
1 change: 1 addition & 0 deletions GitSvnExt/__init__.py
100 changes: 32 additions & 68 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,84 +1,48 @@
git-svn-clone-externals
=======================
git-svn-ext
===========

This is a very simple shell script to make git-svn clone your svn:externals
definitions. Place the script in a directory where you have one or more
svn:externals definitions, run it, and it will:
This work is based on git-svn-clone-externals and the associated
scripts written by Andre Pang.

The methodology remains the same. Put git-svn-ext in your path and
run it from the top-level tree checked out with git-svn. git-svn-ext
will detect and git-svn clone the externals using the following
method:

* git svn clone each external into a .git_externals/ directory.
* symlink the cloned repository in .git_externals/ to the proper directory
name.
* add the symlink and .git_externals/ to the .git/info/excludes/ file, so that
you're not pestered about it when performing a git status.

That's pretty much about it. Low-tech and cheap and cheery, but I couldn't
find anything else like it after extensive Googling, so hopefully some other
people out there with low-tech minds like mine will find this useful.

You could certainly make the script a lot more complex and do things such as
share svn:externals repositories between different git repositories, traverse
through the entire git repository to detect svn:externals definitions instead
of having to place the script in the correct directory, etc... but this works,
it's simple, and it does just the one thing, unlike a lot of other git/svn
integration scripts that I've found. I absolutely do welcome those features,
but I figured I'd push this out since it works for me and is probably useful
for others.

NB: This assumes you have passwordless svn.

Enjoy,

- Andre Pang <[email protected]>


Tools
=====

The git-svn-clone-externals script does a great job of cloning the
svn:externals. However, in day-to-day work I want to check whether I
need to push stuff and update a buch of 'external' repositories in one
go. Therefore I creates some additional scripts.

* ``git-svn-check-unpushed`` tries to determine whether there are
commits which are not yet pushed back to the subversion
repository. Originally I took this idea from Magit (an interface to
the version control system Git, implemented as an extension to
Emacs) and implemented it in Python instead of Lisp.
but the code has been converted to python as one script with
sub-commands, supports newer subversion urls, and adds a few new
features.

This script can be run in every location of a git repository.
From the usage output:

* git-svn-externals-check is a script that displays whether there are
uncommitted changes or commits that are not pushed to the subversion
repository yet. Basically it executes ``git status`` and the
``git-svn-check-unpushed`` scripts for each directory in the current
directory.
Usage: ./git-svn-ext <sub command> [sub command args]

This script must be run in the directory where the original
svn:externals property was set. It does not walk the complete tree
to search for these kind of repositories.
sub commmands:
clone : clone all svn externals into .git_externals
(warning: removes local changes and commits on subsequent runs)
update : Updates all svn externals (git svn fetch[ --revision]/rebase --local)
check-unpushed : Check if local git-svn checkout has unpushed commits
check : run 'git status' and 'check-unpushed' for all externals
for-all : run a command against all externals
(ie: git svn-ext for-all git grep 'whatever')

* git-svn-externals-update complements the git-svn-externals-check
script. The update script does an ``git svn fetch`` and ``git svn
rebase`` for every directory in the location where the script is
executed.
Notes:
externals may be ignored if listed in .git_external_excludes

This script must also be run in the directory where the original
svn:externals property was set.


Feel free to use and improve these scripts.

- Mark van Lent <[email protected]>

Options
Authors
=======

* External repository's url can be rewritten, to use SVN+SSH instead of
plain HTTP or HTTPS. To do so, do `export USE_SSH=yes` in your environment.
This can be useful if you use ssh authentication, but other developers don't.
* If you don't want to pull all external repositories, you can create a
.git_externals_exclude file which contains the local paths to be excluded,
one per line, the same way they show up on the first field of git svn show-externals

- Andre Pang <[email protected]>
- Mark van Lent <[email protected]>
- Alexander Artemenko <[email protected]>
- Wade Berrier <[email protected]>

TODO
====
- make clone not blow stuff away
- handle the case when externals are removed or altered
93 changes: 0 additions & 93 deletions git-svn-check-unpushed

This file was deleted.

141 changes: 0 additions & 141 deletions git-svn-clone-externals

This file was deleted.

Loading