Giter Site home page Giter Site logo

git-svn-clone-externals's Introduction

git-svn-clone-externals
=======================

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:

* 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.

  This script can be run in every location of a git repository.

* 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.

  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.

* 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.

  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
=======

* 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

- Alexander Artemenko <[email protected]>

git-svn-clone-externals's People

Contributors

andrep avatar eipipuz avatar markvl avatar mou avatar pjstevns avatar rcc avatar svetlyak40wt avatar tmc avatar trodrigues avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

git-svn-clone-externals's Issues

Error getting externals with git-svn-clone-external

The script seems to be parsing malformed URLs when I try on our repository.

$ ./git-svn-clone-externals
lib/vendor/http://svn.dwoo.org/trunk/lib -> dwoo
git svn clone dwoo lib/vendor/http://svn.dwoo.org/trunk/lib
Initialized empty Git repository in /home/drak/www/trunk/.git_externals/lib/vendor/http:/svn.dwoo.org/trunk/lib/.git/
Bad URL passed to RA layer: Illegal repository URL 'dwoo' at /usr/lib/git-core/git-svn line 1544

lib/vendor/http://svn.phpdoctrine.org/tags/1.2.1/lib -> Doctrine
git svn clone Doctrine lib/vendor/http://svn.phpdoctrine.org/tags/1.2.1/lib
Initialized empty Git repository in /home/drak/www/trunk/.git_externals/lib/vendor/http:/svn.phpdoctrine.org/tags/1.2.1/lib/.git/
Bad URL passed to RA layer: Illegal repository URL 'Doctrine' at /usr/lib/git-core/git-svn line 1544

recursive svn:externals (not really an issue)

Hello,

Some of the projects I'm working on have more than one level of svn:externals.

projectA/
+projectB(svn:externals in projectA)/
.+projectC(svn:externals in projectB)/

It seems that git-svn-clone-externals does not make recursion, it could be a nice feature to add.

I'll try to give a shot at it, but i'm busy enough not to be able to add such a feature.

Bad URL passed to RA layer

I'm having an issue that git-svn-clone-externals always fail with error:

svn_externals/http://svn/common/include/trunk@26 -> common/include
git svn fetch --all
Bad URL passed to RA layer: Illegal repository URL 'common/include' at /usr/local/share/perl/5.22.1/Git/SVN.pm line 148.
...

I then ran the command git svn show-externals which produced the output:

/svn_externals/http://svn/common/include/trunk@26  common/include
/svn_externals/http://svn/crc/trunk@5567   crc
/svn_externals/http://svn/dualcores/trunk/mpc8641d/ella@3256  dualcores/mpc8641d/ella
...

svn version: 1.9.6
git version: 2.13.4

Thanks in advance,

York

Issue cloning large repositories

I had an issue in cloning large repositories. Took me a little while to track down (learned some more bash along the way), and I've created a fork which basically disables cloning the entire revision history for SVN externals. This allows large repos (like Symfony projects) to be cloned without waiting hours for everything to be indexed.

Just in case anybody had the same issue: https://github.com/MichaelMackus/git-svn-clone-externals

git reset : ambiguous argument on symfony's SVN repository

I tried the git-svn-clone-externals script right out of the repository on symfony right out of it's own svn repository and I got :

git reset --hard branches/1.0/lib
fatal: ambiguous argument 'branches/1.0/lib': unknown revision or path not in the working tree.

svn:externals repository named "http" or "https" and USE_SSH=yes

When using "USE_SSH=yes" and having a svn:externals repository named "https" (for example), the bash substitution pattern for "svn+ssh" is replacing all matches with "svn+ssh".

say:
https://svn.repo.srv/svn/https/trunk
will be substitute with
svn+ssh://svn.repo.srv/svn/svn+ssh/trunk

git-svn-clone-externals doesn't work with a revision specified?

It appears as if git-svn-clone-externals doesn't work when the external specifies the revision to use:

  $ git-svn-clone-externals
  library/shindig/php/src -> 1094333
  git svn clone -r 1094333 library/shindig/php/src
  Using existing [svn-remote "svn"]
  svn-remote.svn.fetch already set to track :refs/remotes/git-svn

  $ git svn show-externals

  # /

  # /library/shindig/php/
  /library/shindig/php/src    -r 1094333    http://svn.apache.org/repos/asf/shindig/trunk/php/src

git-svn-clone-externals fails with authentication

Our svn repos need an username and password:

git svn clone https://... -T trunk -b branches -t tags Client/src/...
Initialized empty Git repository in /home/eilemann/Software/...
Authentication realm: https://...:443 Subversion
Password for 'eilemann':
Authentication realm: https://...:443 Subversion
Username:
Use of uninitialized value $username in chomp at /usr/lib/git-core/git-svn line 4017, line 1.
error: git-svn died of signal 11

do_link fails when local_directory ends with slash

I'm on Mac OS X, so perhaps it's related to that.

I had an SVN external that ended with a slash, e.g. /public/service_support/

When local_directory is assigned, the directory is cleaned up with sed to remove the first slash, but not the trailing slash, so it produces:

public/service_support/

This then fails in do_link because ln doesn't like the trailing slash.

To fix, I piped through a second sed command, like so:

local_directory="$(echo ${words[0]} | sed 's,^/,,' | sed 's,/$,,')"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.