summaryrefslogtreecommitdiff
path: root/git-svn.perl
AgeCommit message (Collapse)Author
2013-10-12git-svn: Warn about changing default for --prefix in Git v2.0Johan Herland
In Git v2.0, we will change the default --prefix for init/clone from none/empty to "origin/" (which causes SVN-tracking branches to be placed at refs/remotes/origin/* instead of refs/remotes/*). This patch warns users about the upcoming change, both in the git-svn manual page, and on stderr when running init/clone in the "multi-mode" without providing a --prefix. Cc: Eric Wong <normalperson@yhbt.net> Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2013-10-10git-svn: fix signed commit parsingNicolas Vigier
When parsing a commit object, git-svn wrongly think that a line containing spaces means the end of headers and the start of the commit message. In case of signed commit, the gpgsig entry contains a line with one space, so "git svn dcommit" will include part of the signature in the commit message. An example of such problem : http://svnweb.mageia.org/treasurer?view=revision&revision=86 This commit changes the regex to only match an empty line as separator between the headers and the commit message. Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2013-06-26Merge branch 'vl/typofix'Junio C Hamano
* vl/typofix: random typofixes (committed missing a 't', successful missing an 's')
2013-06-19random typofixes (committed missing a 't', successful missing an 's')Veres Lajos
Signed-off-by: Veres Lajos <vlajos@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-12Fix `git svn` `rebase` & `dcommit` if top-level HEAD directory existSlava Kardakov
When a file (or a directory) called HEAD exists in the working tree, internal calls git svn makes trigger "did you mean a revision or a path?" ambiguity check. $ git svn rebase fatal: ambiguous argument 'HEAD': both revision and filename Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' rev-list --first-parent --pretty=medium HEAD: command returned error: 128 Explicitly disambiguate by adding "--" after the revision. Signed-off-by: Slava Kardakov <ojab@ojab.ru> Reviewed-by: Jeff King <peff@peff.net> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-20git-svn: introduce --parents parameter for commands branch and tagTobias Schulte
This parameter is equivalent to the parameter --parents on svn cp commands and is useful for non-standard repository layouts. Signed-off-by: Tobias Schulte <tobias.schulte@gliderpilot.de> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2013-05-09git-svn: added an --include-path flagPaul Walmsley
The SVN::Fetcher module is now able to filter for inclusion as well as exclusion (as used by --ignore-path). Also added tests, documentation changes and git completion script. If you have an SVN repository with many top level directories and you only want a git-svn clone of some of them then using --ignore-path is difficult as it requires a very long regexp. In this case it's much easier to filter for inclusion. [ew: remove trailing whitespace] Signed-off-by: Paul Walmsley <pjwhams@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2013-05-09git-svn: avoid self-referencing mergeinfoMichael Contreras
When svn.pushmergeinfo is set, the target branch is included in the mergeinfo if it was previously merged into one of the source branches. SVN does not do this. Remove merge target branch path from resulting mergeinfo when svn.pushmergeinfo is set to better match the behavior of SVN. Update the svn-mergeinfo-push test. [ew: 80 columns] Signed-off-by: Michael Contreras <michael@inetric.com> Reported-by: Avishay Lavie <avishay.lavie@gmail.com> Acked-by: Eric Wong <normalperson@yhbt.net>
2013-02-25git-svn: use a lowercase "usage:" stringDavid Aguilar
Make the usage string consistent with Git. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-24git-svn: use a lowercase "usage:" stringDavid Aguilar
Make the usage string consistent with Git. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-24git-svn: Simplify calculation of GIT_DIRBarry Wardell
Since git-rev-parse already checks for the $GIT_DIR environment variable and that it returns an actual git repository, there is no need to repeat the checks again here. This also fixes a problem where git-svn did not work in cases where .git was a file with a gitdir: link. [ew: squashed test case, delay setting GIT_DIR until after `git rev-parse --cdup` to fix t9101, (thanks to Junio)] Signed-off-by: Barry Wardell <barry.wardell@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2013-01-17git-svn: teach find-rev to find near matchesJohn Keeping
When a single SVN repository is split into multiple Git repositories many SVN revisions will exist in only one of the Git repositories created. For some projects the only way to build a working artifact is to check out corresponding versions of various repositories, with no indication of what those are in the Git world - in the SVN world the revision numbers are sufficient. By adding "--before" to "git-svn find-rev" we can say "tell me what this repository looked like when that other repository looked like this": git svn find-rev --before \ r$(git --git-dir=/over/there.git svn find-rev HEAD) Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-10-05git-svn: use path accessor for Git::SVN objectsEric Wong
The accessors should improve maintainability and enforce consistent access to Git::SVN objects. Signed-off-by: Eric Wong <normalperson@yhbt.net> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
2012-08-22Merge branch 'ms/git-svn-1.7'Junio C Hamano
A series by Michael Schwern via Eric to update git-svn to revamp the way URLs are internally passed around, to make it work with SVN 1.7. * ms/git-svn-1.7: git-svn: remove ad-hoc canonicalizations git-svn: canonicalize newly-minted URLs git-svn: introduce add_path_to_url function git-svn: canonicalize earlier git-svn: replace URL escapes with canonicalization git-svn: attempt to mimic SVN 1.7 URL canonicalization t9107: fix typo t9118: workaround inconsistency between SVN versions Git::SVN{,::Ra}: canonicalize earlier git-svn: path canonicalization uses SVN API Git::SVN::Utils: remove irrelevant comment git-svn: add join_paths() to safely concatenate paths git-svn: factor out _collapse_dotdot function git-svn: use SVN 1.7 to canonicalize when possible git-svn: move canonicalization to Git::SVN::Utils use Git::SVN{,::RA}->url accessor globally use Git::SVN->path accessor globally Git::SVN::Ra: use accessor for URLs Git::SVN: use accessor for URLs internally Git::SVN: use accessors internally for path
2012-08-10git svn: handle errors and concurrent commits in dcommitRobert Luberda
dcommit didn't handle errors returned by SVN and coped very poorly with concurrent commits that appear in SVN repository while dcommit was running. In both cases it left git repository in inconsistent state: index (which was reset with `git reset --mixed' after a successful commit to SVN) no longer matched the checkouted tree, when the following commit failed or needed to be rebased. See http://bugs.debian.org/676904 for examples. This patch fixes the issues by: - introducing error handler for dcommit. The handler will try to rebase or reset working tree before returning error to the end user. dcommit_rebase function was extracted out of cmd_dcommit to ensure consistency between cmd_dcommit and the error handler. - calling `git reset --mixed' only once after all patches are successfully committed to SVN. This ensures index is not touched for most of the time of dcommit run. Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-08-02git-svn: remove ad-hoc canonicalizationsMichael G. Schwern
[ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-08-02git-svn: introduce add_path_to_url functionMichael G. Schwern
Remove the ad-hoc versions. This is mostly to normalize the process and ensure the URLs produced don't have double slashes or anything. Also provides a place to fix the corner case where a file path contains a percent sign. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-08-02git-svn: canonicalize earlierMichael G. Schwern
Just a few things I noticed. Its good to canonicalize as early as possible. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-08-02git-svn: replace URL escapes with canonicalizationMichael G. Schwern
The old hand-rolled URL escape functions were inferior to canonicalization functions. Continuing to move towards getting everything canonicalizing the same way. * Git::SVN->init_remote_config and Git::SVN::Ra->minimize_url both have to canonicalize the same way else init_remote_config will incorrectly think they're different URLs causing t9107-git-svn-migrate.sh to fail. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-08-02git-svn: add join_paths() to safely concatenate pathsMichael G. Schwern
Otherwise you might wind up with things like... my $path1 = undef; my $path2 = 'foo'; my $path = $path1 . '/' . $path2; creating '/foo'. Or this... my $path1 = 'foo/'; my $path2 = 'bar'; my $path = $path1 . '/' . $path2; creating 'foo//bar'. Could have used File::Spec, but I'm shying away from it due to SVN 1.7's pickiness about paths. Felt it would be better to have our own we can control completely. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-08-02git-svn: move canonicalization to Git::SVN::UtilsMichael G. Schwern
So they can be used by others. I'd like to test them, but they're going to become SVN API wrappers shortly and those aren't predictable. No functional change. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-08-02use Git::SVN{,::RA}->url accessor globallyMichael G. Schwern
Note: The structure returned from Git::SVN->read_all_remotes() does not appear to contain objects, so I'm leaving them alone. That's everything converted over to the url and path accessors. No functional change. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-08-02use Git::SVN->path accessor globallyMichael G. Schwern
No functional change. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-07-27Extract Git::SVN::GlobSpec from git-svn.Michael G. Schwern
Straight cut & paste. That's the last class. * Make Git::SVN load it on its own, its the only thing that needs it. Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-07-27Move Git::IndexInfo into its own file.Michael G. Schwern
Straight cut & paste. Didn't require any fixing. Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-07-27Load all the modules in one place and before running code.Michael G. Schwern
Just makes the code easier to follow. No functional change. Also eliminate an unused lexical $SVN. Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-07-27Extract Git::SVN::Migration from git-svn.Michael G. Schwern
Straight cut & paste. Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-07-27Prepare Git::SVN::Migration for extraction from git-svn.Michael G. Schwern
* Load Git command functions on its own. * Load Git::SVN modules on its own. Drive by refactorings... * Use our() instead of use vars. * Eliminate the auto loading of Git functions. Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-07-27Extract Git::SVN::Log from git-svn.Michael G. Schwern
Straight cut & paste. Also noticed Git::SVN::Ra wasn't in the compile test. It is now. Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-07-27Prepare Git::SVN::Log for extraction from git-svn.Michael G. Schwern
* Load Git command functions itself. * Can't access the git-svn switch lexical any more, but its only used by Git::SVN::Log so turn it into a Git::SVN::Log global. * Load Git::SVN as needed. No need to load it always, its only used twice. * Moved a state variable to the routine it's used for. (Drive by refactoring) Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-07-27Move initialization of Git::SVN variables into Git::SVN.Michael G. Schwern
Also it can compile on its own now, yay! Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-07-27Extract Git::SVN from git-svn into its own .pm file.Michael G. Schwern
Except for adding the 1; at the end, this is a straight copy & paste. Tests still pass, but its doubtful Git::SVN will compile on its own without git-svn being loaded. Next commit will fix that. Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-07-27Prepare Git::SVN for extraction into its own file.Michael G. Schwern
This means it should be able to load without git-svn being loaded. * Load Git.pm on its own and all the needed command functions. * It needs to grab at a git-svn lexical $_prefix representing the --prefix option. Provide opt_prefix() for that. This is a refactoring artifact. The prefix should really be passed into Git::SVN->new. * Unqualify unnecessarily fully qualified globals like $Git::SVN::default_repo_id. * Lexically isolate the class just to make sure nothing is leaking out. Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-07-27Extract some utilities from git-svn to allow extracting Git::SVN.Michael G. Schwern
Put them in a new module called Git::SVN::Utils. Yeah, not terribly original and it will be a dumping ground. But its better than having them in the main git-svn program. At least they can be documented and tested. * fatal() is used by many classes. * Change the $can_compress lexical into a function. This should be enough to extract Git::SVN. Signed-off-by: Michael G. Schwern <schwern@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-07-19git-svn: don't create master if another head existsMarcin Owsiany
git-svn insists on creating the "master" head (unless it exists) on every "fetch". It is useful that it gets created initially, when no head exists - users expect this git convention of having a "master" branch on initial clone. However creating it when there already is another head does not provide any value - the ref is never updated, so it just gets stale after a while. Also, some users find it annoying that it gets recreated, especially when they would like the git branch names to follow SVN repository branch names. More background in http://thread.gmane.org/gmane.comp.version-control.git/115030 Make git-svn skip the "master" creation if HEAD already points at a valid head. This means "master" does get created on initial "clone" but does not get recreated once a user deletes it. Also, make post_fetch_checkout work with any head that is pointed to by HEAD, not just "master". Also, use fatal error handling consistent with the rest of the program for post_fetch_checkout. Signed-off-by: Marcin Owsiany <marcin@owsiany.pl> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-06-10git-svn: use YAML format for mergeinfo cache when possibleJonathan Nieder
Since v1.7.0-rc2~11 (git-svn: persistent memoization, 2010-01-30), git-svn has maintained some private per-repository caches in .git/svn/.caches to avoid refetching and recalculating some mergeinfo-related information with every "git svn fetch". These caches use the 'nstore' format from the perl core module Storable, which can be read and written quickly and was designed for transfer over the wire (the 'n' stands for 'network'). This format is endianness-independent and independent of floating-point representation. Unfortunately the format is *not* independent of the perl version --- new perl versions will write files that very old perl cannot read. Worse, the format is not independent of the size of a perl integer. So if you toggle perl's use64bitint compile-time option, then using 'git svn fetch' on your old repositories produces errors like this: Byte order is not compatible at ../../lib/Storable.pm (autosplit into ../../lib/auto/Storable/_retrieve.al) line 380, at /usr/share/perl/5.12/Memoize/Storable.pm line 21 That is, upgrading perl to a version that uses use64bitint for the first time makes git-svn suddenly refuse to fetch in existing repositories. Removing .git/svn/.caches lets git-svn recover. It's time to switch to a platform independent serializer backend with better compatibility guarantees. This patch uses YAML::Any. Other choices were considered: - thawing data from Data::Dumper involves "eval". Doing that without creating a security risk is fussy. - the JSON API works on scalars in memory and doesn't provide a standard way to serialize straight to disk. YAML::Any is reasonably fast and has a pleasant API. In most backends, LoadFile() reads the entire file into a scalar anyway and converts it as a second step, but having an interface that allows the deserialization to happen on the fly without a temporary is still a comfort. YAML::Any is not a core perl module, so we take care to use it when and only when it is available. Installations without that module should fall back to using Storable with all its quirks, keeping their cache files in .git/svn/.caches/*.db Installations with YAML peacefully coexist by keeping a separate set of cache files in .git/svn/.caches/*.yaml. In most cases, switching between is a one-time thing, so it doesn't seem worth the complication to migrate existing caches. The upshot: after this patch, as long as YAML::Any is installed you can move your git repository between machines with different perl installations and "git svn fetch" will work fine. If you do not have YAML::Any, the behavior is unchanged (and in particular does not get any worse). Reported-by: Sandro Weiser <sandro.weiser@informatik.tu-chemnitz.de> Reported-by: Bdale Garbee <bdale@gag.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-06-10git-svn: make Git::SVN::RA a separate fileJonathan Nieder
This slices off another 600 or so lines from the frighteningly long git-svn.perl script. The Git::SVN::Ra interface is similar enough to SVN::Ra that it is probably safe to ignore most of its implementation on first reading. (Documenting or moving functions that do not fit that pattern is left as an exercise to the interested reader.) [ew: rebased and fixed conflict against commit c26ddce86d7215b4d9687bd4c6b5dd43a3fabf31 (git-svn: platform auth providers are working only on 1.6.15 or newer)] Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-06-10git-svn: make Git::SVN::Editor a separate fileJonathan Nieder
This makes the git-svn script shorter and less scary for beginners to read through for the first time. Take the opportunity to explain the purpose and basic interface of the Git::SVN::Editor class while at it. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-06-07Merge branch 'jc/svn-auth-providers-unusable-at-1.6.12'Junio C Hamano
Regression fix for people with libsvn between 1.6.12 and 1.6.15, on which we tried to use the non-working platform auth providers. * jc/svn-auth-providers-unusable-at-1.6.12: git-svn: platform auth providers are working only on 1.6.15 or newer
2012-06-04git-svn: platform auth providers are working only on 1.6.15 or newerJunio C Hamano
Matthijs Kooijman reports that the cut-off point 082afee (git-svn: use platform specific auth providers, 2012-04-26) set at 1.6.12 to use this feature safely was incorrect, and it is 1.6.15 instead: http://svn.apache.org/repos/asf/subversion/trunk/CHANGES Version 1.6.15 * improve some swig parameter mapping (r984565, r1035745) Signed-off-by: Junio C Hamano <gitster@pobox.com> Acked-by: Eric Wong <normalperson@yhbt.net>
2012-05-29git-svn: make Git::SVN::Fetcher a separate fileJonathan Nieder
This patch removes a chunk of code (the Git::SVN::Fetcher consumer of libsvn's tree delta protocol) from git-svn.perl and documents its interface so the hurried reader does not have to read that code right away. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-05-29git-svn: rename SVN::Git::* packages to Git::SVN::*Jonathan Nieder
Using names in the Git:: namespace means these cannot conflict with a hypothetical binding teaching Subversion to interact with git repositories. Currently the packages are private to git-svn.perl so the choice of name isn't likely to make much difference. This change is mainly meant as preparation for splitting out the packages in question as modules on the public search path. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-05-29git-svn: move Git::SVN::Prompt into its own fileJonathan Nieder
git-svn.perl is very long (around 6500 lines) and although it is nicely split into modules, some new readers do not even notice --- it is too distracting to see all this functionality collected in a single file. Splitting it into multiple files would make it easier for people to read individual modules straight through and to experiment with components separately. Let's start with Git::SVN::Prompt. For simplicity, we install this as a module in the standard search path, just like the existing Git and Git::I18N modules. In the process, add a manpage explaining its interface and that it is not likely to be useful for other projects to avoid confusion. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-05-17git-svn: support rebase --preserve-mergesAvishay Lavie
When git svn rebase is performed after an unpushed merge, the rebase operation follows both parents and replays both the user's local commits and those from the merged branch. This is usually not the intended behavior. This patch adds support for the --preserve-merges/-p flag which allows for a better workflow by re-applying merge commits as merges. [ew: fixed a minor syntax error] Signed-off-by: Avishay Lavie <avishay.lavie@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
2012-05-02Merge branch 'master' of git://git.bogomips.org/git-svnJunio C Hamano
via Eric Wong * 'master' of git://git.bogomips.org/git-svn: git-svn: introduce SVN version comparison function
2012-05-02Merge branch 'jk/maint-gitweb-test-use-sane-perl'Junio C Hamano
When using a Perl script on a system where "perl" found on user's $PATH could be ancient or otherwise broken, we allow builders to specify the path to a good copy of Perl with $PERL_PATH. The gitweb test forgot to use that Perl when running its test. By Jeff King (1) and Zbigniew Jędrzejewski-Szmek (1) * jk/maint-gitweb-test-use-sane-perl: Consistently use perl from /usr/bin/ for scripts t/gitweb-lib: use $PERL_PATH to run gitweb
2012-05-02git-svn: introduce SVN version comparison functionJunio C Hamano
With double-digit version components in SVN::Core::VERSION, a naive string comparison is no longer sufficient and a numeric comparison is required for correct results. This fixes a regression introduced in commit 082afee621aeb2d3746c8ae290af98823f981f34 ("git-svn: use platform specific auth providers") where SVN version "1.6.6" was incorrectly assumed to be newer than the required "1.6.12" version. [mk: fix namespace references] [ew: commit message] Tested-by: Matthijs Kooijman <matthijs@stdin.nl> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-01Consistently use perl from /usr/bin/ for scriptsZbigniew Jędrzejewski-Szmek
While the majority of scripts use '#!/usr/bin/perl', some use '#!/usr/bin/env perl'. In the end there is no difference, because the Makefile rewrites "#!.*perl" with "#!$PERL_PATH" in scripted Porcelains before installing. Nevertheless, the second form can be misleading, because it suggests that perl found first in $PATH will be used. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-27git-svn: use platform specific auth providersMatthijs Kooijman
On Linux, this makes authentication using passwords from gnome-keyring and kwallet work (only the former was tested). On Mac OS X, this allows using the OS X Keychain. Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl> Acked-by: Eric Wong <normalperson@yhbt.net>
2012-04-24git-svn: drop redundant blocking of SIGPIPERoman Kagan
Now that SIGPIPE is ignored there's no point blocking it. Signed-off-by: Roman Kagan <rkagan@mail.ru> Acked-by: Eric Wong <normalperson@yhbt.net>