Commit graph

589 commits

Author SHA1 Message Date
Marc-Andre Lureau ea14e6c554 git-svn: fix find-rev error message when missing arg
Just let the user know that a revision argument is missing instead of
a perl error. This error message mimic the "init" error message, but
could be improved.

Signed-off-by: Marc-Andre Lureau <marcandre.lureau@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-11 21:20:50 -07:00
Junio C Hamano ad416ed433 Merge branch 'maint' to sync with 1.5.4.4
* maint:
  GIT 1.5.4.4
  ident.c: reword error message when the user name cannot be determined
  Fix dcommit, rebase when rewriteRoot is in use
  Really make the LF after reset in fast-import optional
2008-03-08 20:07:57 -08:00
John Goerzen 0bb91d9a62 Fix dcommit, rebase when rewriteRoot is in use
When the rewriteRoot setting is used with git-svn, it causes the svn
IDs added to commit messages to bear a different URL than is actually
used to retrieve Subversion data.

It is common for Subversion repositories to be available multiple
ways: for instance, HTTP to the public, and svn+ssh to people with
commit access.  The need to switch URLs for access is fairly common as
well -- perhaps someone was just given commit access.  To switch URLs
without having to rewrite history, one can use the old url as a
rewriteRoot, and use the new one in the svn-remote url setting.

This works well for svn fetching and general git commands.

However, git-svn dcommit, rebase, and perhaps other commands do not
work in this scenario.  They scan the svn ID lines in commit messages
and attempt to match them up with url lines in [svn-remote] sections
in the git config.

This patch allows them to match rewriteRoot options, if such options
are present.

Signed-off-by: John Goerzen <jgoerzen@complete.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
2008-03-08 19:20:06 -08:00
Sebastian Noack 77266e96d3 git-svn: Don't prompt for client cert password everytime.
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-27 13:18:35 -08:00
Sebastian Noack 47e83e3cc0 git-svn: Don't prompt for client cert password everytime.
Acked-by: Eric Wong <normalperson@yhbt.net>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-27 12:01:33 -08:00
Tim Stoakes 6fb5375ede Add `git svn blame' command
This command is identical to `git blame', but it shows SVN revision
numbers instead of git commit hashes.

[ew: support "^initial commit" and minor formatting fixes]

Signed-off-by: Tim Stoakes <tim@stoakes.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-11 13:23:14 -08:00
Eric Wong c586879cdf git-svn: improve repository URL matching when following parents
This way we can avoid the spawning of a new SVN::Ra session by
reusing the existing one.

The most problematic issue is that some svn servers disallow
too many connections from a single IP, so this will allow
git-svn to fetch from those repositories with a higher success
rate by using fewer connections.

This sometimes showed up as a new (and redundant)
[svn-remote "$parent_refname"] entry in $GIT_DIR/svn/.metadata.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-06 13:50:21 -08:00
Karl Hasselström 94bc914c5e Let "git svn" run "git gc --auto" occasionally
Let "git svn" run "git gc --auto" every 1000 imported commits to
reduce the number of loose objects.

To handle the common use case of frequent imports, where each
invocation typically fetches much less than 1000 commits, also run gc
unconditionally at the end of the import.

"1000" is the same number that was used by default when we called
git-repack. It isn't necessarily still the best choice.

Signed-off-by: Karl Hasselström <kha@treskal.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-03 13:00:09 -08:00
Karl Hasselström af788a6eb5 git-svn: Don't call git-repack anymore
In a moment, we'll start calling git-gc --auto instead, since it is a
better fit to what we're trying to accomplish.

The command line options are still accepted, but don't have any
effect, and we warn the user about that.

Signed-off-by: Karl Hasselström <kha@treskal.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-03 12:59:24 -08:00
Eric Wong 3b839fd861 git-svn: default to repacking every 1000 commits
This should reduce disk space usage when doing large imports.
We'll be switching to "gc --auto" post-1.5.4 to handle
repacking for us.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-22 01:45:40 -08:00
Eric Wong 98fa5b6851 git-svn: handle leading/trailing whitespace from svnsync revprops
Repositories generated by svnsync cannot be relied on to have
properly set revprops without newlines in UUIDs and URLs.  There
may be broken versions of svnsync out there that append extra
newlines to UUIDs, or the revprops could've been changed by
repository administrators at any time, too.

At least one repository we've come across has an embedded
newline erroneously set in the svnsync-uuid prop.  This is bad
because the trailing newline is taken as another record by the
Git.pm library, and the wantarray detection causes tmp_config()
to return an array with an empty-but-existing second element.

We will now strip leading and trailing whitespace both before
setting and after reading the uuid and url for svnsync values.
We will also force tmp_config to return a single scalar when
reading existing values.

SVN UUIDs should never have whitespace in them, and SVN
repository URLs should be URI-escaped, so neither of those
values we ever see in git-svn should actually have whitespace
in them.

Thanks to Dennis Schridde for the bug report and Junio for
helping diagnose this.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-12 10:58:06 -08:00
Kevin Ballard 35cda06164 Trim leading / off of paths in git-svn prop_walk
prop_walk adds a leading / to all subdirectory paths. Unfortunately
this causes a problem when the remote repo lives in a subdirectory itself,
as the leading / causes subsequent PROPFIND calls to be executed on
the wrong path. Trimming the / before calling the PROPFIND fixes this problem.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-09 14:56:49 -08:00
Junio C Hamano e708af6e58 Merge in GIT 1.5.3.8
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-08 00:58:33 -08:00
Eric Wong eee8a1742b git-svn: clarify the "Ignoring error from SVN" piece
I've heard of several users puzzled by this, and it sometimes it
appears as if git-svn is doing nothing on slower connections and
larger repositories.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-07 16:25:31 -08:00
Eric Wong f5530b8833 git-svn: support for funky branch and project names over HTTP(S)
SVN requires that paths be URI-escaped for HTTP(S) repositories.
file:// and svn:// repositories do not need these rules.

Additionally, accessing individual paths inside repositories
(check_path() and get_log() do NOT require escapes to function
and in fact it breaks things).

Noticed-by: Michael J. Cohen <mjc@cruiseplanners.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-07 15:18:37 -08:00
Eric Wong 321b1842dc git-svn: unlink index files that were globbed, too
commit 3157dd9e89 (git-svn: unlink
internal index files after operations) introduced unlinking
index files after fetching.  However, this missed indices for
refs that were created by globbing branches and tags.  This will
track all refs we ever touch during a fetch and unlink them at
exit time.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-02 10:44:22 -08:00
Eric Wong 7dfa16b9dc git-svn: allow dcommit --no-rebase to commit multiple, dependent changes
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-02 10:43:54 -08:00
Eric Wong 540424b263 git-svn: avoid warning when run without arguments
While we're in the area, finish writing a halfway-written
comment describing what that block does...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-12-19 00:33:15 -08:00
Eric Wong 7fc35e0e94 git-svn: workaround a for broken symlinks in SVN
It's possible for bad clients to commit symlinks without the
5-character "link " prefix in symlinks.  So guard around this
bug in SVN and make a best effort to create symlinks if the
"link " prefix is missing.

More information on this SVN bug is described here:
  http://subversion.tigris.org/issues/show_bug.cgi?id=2692

To be pedantic, there is still a corner case that neither we nor
SVN can handle:  If somebody made a link using a broken SVN
client where "link " is the first part of its path, e.g.
"link sausage", then we'd end up having a symlink which points
to "sausage" because we incorrectly stripped the "link ".
Hopefully this hasn't happened in practice, but if it has,
it's not our fault SVN is broken :)

Thanks to Benoit Sigoure and Sverre Johansen for reporting
and feedback.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-12-19 00:17:07 -08:00
Eric Wong ad94802a7b git-svn: avoid leaving leftover committer/author info in rebase
We set the 6 environment variables for controlling
committer/author email/name/time for every commit.

We do this in the parent process to be passed to
git-commit-tree, because open3() doesn't afford us the control
of doing it only in the child process.  This means we leave them
hanging around in the main process until the next revision comes
around and all 6 environment variables are overwridden again.

Unfortunately, for the last commit, leaving them hanging around
means the git-rebase invocation will pick it up, rewriting the
rebased commit with incorrect author information.  This should fix
it.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-12-19 00:04:21 -08:00
Eric Wong 12a6d752fb git-svn: handle our top-level path being deleted and later re-added
Previously, git-svn would ignore cases where the path we're
tracking is removed from the repository.  This was to prevent
heads with follow-parent from ending up with a tree full of
empty revisions (and thus breaking rename detection).

The previous behavior is fine until the path we're tracking
is re-added later on, leading to the old files being merged
in with the new files in the directory (because the old
files were never marked as deleted)

We will now only remove all the old files locally that were
deleted remotely iff we detect the directory we're in is being
created from scratch.

Thanks for Marcus D. Hanwell for the bug report and
Peter Baumann for the analysis.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 12:06:23 -08:00
Eric Wong 3157dd9e89 git-svn: unlink internal index files after operations
Being git, we can generate these very quickly on the fly as
needed, so there's no point in wasting space for these things
for large projects.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-13 09:54:45 -08:00
Andy Whitcroft 5ff6aae895 git-svn: expand handling of From: and Signed-off-by:
The current parsing for From: and Signed-off-by: lines handles fully
specified names:

	From: Full Name <email@address>

Expand this to include the raw email addresses and straight "names":

	From: email@address       -> email <email@address>
	From: Full Name           -> Full Name <unknown>

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-13 09:47:48 -08:00
Junio C Hamano 3e5f260144 Merge branch 'ew/svn-rev-db'
* ew/svn-rev-db:
  git-svn: reinstate old rev_db optimization in new rev_map
  git-svn: replace .rev_db with a more space-efficient .rev_map format
2007-12-12 16:53:06 -08:00
Jeff King cd459e3ffa git-svn: get color config from --get-colorbool
git-config recently learned a --get-colorbool option. By
using it, we will get the same color=auto behavior that
other git commands have.

Specifically, this fixes the case where "color.diff = true"
meant "always" in git-svn, but "auto" in other programs.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-11 00:42:07 -08:00
Eric Wong 66ab84b99c git-svn: reinstate old rev_db optimization in new rev_map
This reinstates an old optimization in .rev_db which
stored the highest revision number we scanned, allowing
us to avoid scanning the SVN log for those revisions
again in a subsequent invocation.

This means the last 24-byte record in a .rev_map file
can be a 4-byte SVN revision number with 20-bytes of
zeroes representing a non-existent commit.  This record
can and will be overwritten when a new commit iff
the commit is all zeroes.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-10 21:28:27 -08:00
Eric Wong 060610c572 git-svn: replace .rev_db with a more space-efficient .rev_map format
Migrations are done automatically on an as-needed basis when new
revisions are to be fetched.  Stale remote branches do not get
migrated, yet.

However, unless you set noMetadata or useSvkProps it's safe to
just do:

  find $GIT_DIR/svn -name '.rev_db*' -print0 | xargs rm -f

to purge all the old .rev_db files.

The new format is a one-way migration and is NOT compatible with
old versions of git-svn.

This is the replacement for the rev_db format, which was too big
and inefficient for large repositories with a lot of sparse history
(mainly tags).

The format is this:

  - 24 bytes for every record,
    * 4 bytes for the integer representing an SVN revision number
    * 20 bytes representing the sha1 of a git commit

  - No empty padding records like the old format

  - new records are written append-only since SVN revision numbers
    increase monotonically

  - lookups on SVN revision number are done via a binary search

  - Piping the file to xxd(1) -c24 is a good way of dumping it for
    viewing or editing, should the need ever arise.

As with .rev_db, these files are disposable unless noMetadata or
useSvmProps is set.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-10 21:28:25 -08:00
Steven Grimm cec0d5a3bb git-svn: Don't create a "master" branch every time rebase is run
If you run "git-svn rebase" while sitting on a topic branch, there is
no need to create a "master" branch if one didn't exist already. The
branch was created implicitly by the automatic checkout after fetching,
which in the case of rebase isn't actually necessary anyway.

Signed-off-by: Steven Grimm <koreth@midwinter.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-30 23:32:51 -08:00
Vineet Kumar 2d87979215 git-svn: add a show-externals command.
show-externals can be used by scripts to provide svn:externals-like
functionality.  For example, a script can list all of the externals and then
use check out the listed URLs at the appropriate paths, similar to what the svn
client does.  Said script (or perhaps git-svn itself, in the future) could
simply invoke svn export on the paths, or it could go one further, using
git-svn clone and even git-submodule together to better integrate externals
checkouts.

The implementation is shamelessly copied from show-ignores.  A more general
command to list user-specified properties is probably a better idea.

Signed-off-by: Vineet Kumar <vineet@doorstop.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-30 23:32:51 -08:00
David D. Kilzer 8d7c4fad3f git-svn: Remove unnecessary Git::SVN::Util package
Digest::MD5 is loaded regardless of the package in which it's
declared, so move its 'use' statement and the md5sum() function
into the main package.

Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-30 23:32:51 -08:00
Andy Whitcroft 70ae04e4e8 git-svn: add support for pulling author from From: and Signed-off-by:
Add support for pulling the real author of a commit from the From:
and first Signed-off-by: fields of the SVN commit message.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-30 23:32:51 -08:00
Gustaf Hendeby f4dd334bff git-svn now reads settings even if called in subdirectory
Previously, git-svn first read the .git/config file for settings as if
current working directory was the repository top-directory, and after
that made sure to cd into top-directory.  The result was a silent
failur to read configuration settings.  This patch changes the order
these two things are done.

Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-30 23:29:27 -08:00
Eric Wong a5460eb7bb git-svn: allow `info' command to work offline
Cache the repository root whenever we connect to the repository.
This will allow us to notice URL changes if the user changes the
URL in .git/config, too.

If the repository is no longer accessible, or if `git svn info'
is the first and only command run; then '(offline)' will be
displayed for "Repository Root:" in the output.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-11-21 20:11:11 -08:00
David D. Kilzer 8b014d7157 git-svn: info --url [path]
Return the svn URL for the given path, or return the svn
repository URL if no path is given.

Added 18 tests to t/t9119-git-svn-info.sh.

Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-21 20:11:11 -08:00
David D. Kilzer e6fefa926d git-svn info: implement info command
Implement "git-svn info" for files and directories based on the
"svn info" command.  Note that the -r/--revision argument is not
supported yet.

Added 18 tests in t/t9119-git-svn-info.sh.

[ew: small fix to work without arguments on all working directories]

Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-21 20:11:11 -08:00
David D. Kilzer b2b3ada7fc git-svn: extract reusable code into utility functions
Extacted canonicalize_path() in the main package.

Created new Git::SVN::Util package with an md5sum() function.  A
new package was created so that Digest::MD5 did not have to be
loaded in the main package.  Replaced code in the SVN::Git::Editor
and SVN::Git::Fetcher packages with calls to md5sum().

Extracted the format_svn_date(), parse_git_date() and
set_local_timezone() functions within the Git::SVN::Log package.

Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-21 20:11:11 -08:00
David Reiss 826a93398d git-svn: Fix a typo and add a comma in an error message in git-svn
Signed-off-by: David Reiss <dreiss@facebook.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-17 13:39:47 -08:00
David D Kilzer 111947ef8c git-svn log: handle unreachable revisions like "svn log"
When unreachable revisions are given to "svn log", it displays all commit
logs in the given range that exist in the current tree.  (If no commit
logs are found in the current tree, it simply prints a single commit log
separator.)  This patch makes "git-svn log" behave the same way.

Ten tests added to t/t9116-git-svn-log.sh.

Signed-off-by: David D Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-17 13:28:21 -08:00
David D Kilzer 60f3ff1257 git-svn log: include commit log for the smallest revision in a range
The "svn log -rM:N" command shows commit logs inclusive in the range [M,N].
Previously "git-svn log" always excluded the commit log for the smallest
revision in a range, whether the range was ascending or descending.  With
this patch, the smallest revision in a range is always shown.

Updated tests for ascending and descending revision ranges.

Signed-off-by: David D Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-17 13:28:21 -08:00
David D Kilzer fede44b2e1 git-svn log: fix ascending revision ranges
Fixed typo in Git::SVN::Log::git_svn_log_cmd().  Previously a command like
"git-svn log -r1:4" would only show a commit log separator.

Added tests for ascending and descending revision ranges.

Signed-off-by: David D Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-17 13:28:21 -08:00
Konstantin V. Arkhipov 3caf320ba8 git-svn's dcommit must use subversion's config
When doing dcommit git-svn must use subversion's config or newly created
files will not include svn's properties
(defined in [auto-props] with 'enable-auto-props = yes').

Signed-off-by: Konstantin V. Arkhipov <voxus@onphp.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-11-17 13:28:21 -08:00
Eric Wong cfbe7ab333 git-svn: support for funky branch and project names over HTTP(S)
SVN requires that paths be URI-escaped for HTTP(S) repositories.
file:// and svn:// repositories do not need these rules.

Additionally, accessing individual paths inside repositories
(check_path() and get_log() do NOT require escapes to function
and in fact it breaks things).

Noticed-by: Michael J. Cohen <mjc@cruiseplanners.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-12 00:22:49 -08:00
Junio C Hamano 35865ca245 Merge branch 'maint'
* maint:
  for-each-ref: fix off by one read.
  git-branch: remove mention of non-existent '-b' option
  git-svn: prevent dcommitting if the index is dirty.
  Fix memory leak in traverse_commit_list
2007-11-12 00:14:15 -08:00
Benoit Sigoure c8cfa3e4a5 git-svn: prevent dcommitting if the index is dirty.
dcommit uses rebase to sync the history with what has just been pushed to
SVN.  Trying to dcommit with a dirty index is troublesome for rebase, so now
the user will get an error message if he attempts to dcommit with a dirty
index.

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-11 23:40:32 -08:00
Junio C Hamano fe61935007 Merge branch 'maint'
* maint:
  Remove a couple of duplicated include
  grep with unmerged index
  git-daemon: fix remote port number in log entry
  git-svn: t9114: verify merge commit message in test
  git-svn: fix dcommit clobbering when committing a series of diffs
2007-11-05 22:03:47 -08:00
Eric Wong c74d9acf20 git-svn: fix dcommit clobbering when committing a series of diffs
Our revision number sent to SVN is set to the last revision we
committed if we've made any previous commits in a dcommit
invocation.

Although our SVN Editor code uses the delta of two (old) trees
to generate information to send upstream, it'll still send
complete resultant files upstream; even if the tree they're
based against is out-of-date.

The combination of sending a file that does not include the
latest changes, but set with a revision number of a commit we
just made will cause SVN to accept the resultant file even if it
was generated against an old tree.

More trouble was caused when fixing this because we were
rebasing uncessarily at times.  We used git-diff-tree to check
the imported SVN revision against our HEAD, not the last tree we
committed to SVN.  The unnecessary rebasing caused merge commits
upstream to SVN to fail.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 12:57:34 -08:00
Benoit Sigoure aa807bc266 git-svn: sort the options in the --help message.
"git svn <cmd> --help" gave options in the order they were found in a
Perl hash, which meant "randomly" to humans.

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-03 21:39:12 -07:00
Benoit Sigoure 207f1a75e7 git-svn: simplify the handling of fatal errors
* git-svn.perl (&fatal): Append the newline at the end of the error
	message.
	Adjust all callers.

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-17 02:47:37 -04:00
Benoit Sigoure 51e057cf80 git-svn: add git svn proplist
This allows one to easily retrieve a list of svn properties from within
git-svn without requiring svn or knowing the URL of a repository.

	* git-svn.perl (%cmd): Add the command `proplist'.
	(&cmd_proplist): New.
	* t/t9101-git-svn-props.sh: Test git svn proplist.

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-17 02:47:37 -04:00
Benoit Sigoure 1515345156 git-svn: add git svn propget
This allows one to easily retrieve a single SVN property from within
git-svn without requiring svn or remembering the URL of a repository

	* git-svn.perl (%cmd): Add the new command `propget'.
	($cmd_dir_prefix): New global.
	(&get_svnprops): New helper.
	(&cmd_propget): New.  Use &get_svnprops.
	* t/t9101-git-svn-props.sh: Add a test case for propget.

[ew: make sure the rev-parse --show-prefix call doesn't break
     the `git-svn clone' command]

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-17 02:47:37 -04:00
Benoit Sigoure d05ddec51e git-svn: implement git svn create-ignore
git svn create-ignore (to create one .gitignore per directory
from the svn:ignore properties.  This has the disadvantage of
committing the .gitignore during the next dcommit, but when you
import a repo with tons of ignores (>1000), using git svn show-ignore
to build .git/info/exclude is *not* a good idea, because things like
git-status will end up doing >1000 fnmatch *per file* in the repo,
which leads to git-status taking more than 4s on my Core2Duo 2Ghz 2G
RAM)

	* git-svn.perl (%cmd): Add the new command `create-ignore'.
	(&cmd_create_ignore): New.
	* t/t9101-git-svn-props.sh: Adjust the test-case for show-ignore and
	add a test case for create-ignore.

[ew: added commit message from
  <05CAB148-56ED-4FF1-8AAB-4BA2A0B70C2C@lrde.epita.fr> ]

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-17 02:47:36 -04:00
Benoit Sigoure 01bdab84e3 git-svn: add a generic tree traversal to fetch SVN properties
* git-svn.perl (&traverse_ignore): Remove.
	(&prop_walk): New.
	(&cmd_show_ignore): Use prop_walk.

[ew: This will ease the implementation of the `create-ignore',
     `propget', and `proplist' commands]

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-17 02:47:36 -04:00
Eygene Ryabinkin fd499bcc9d git-svn: use "no warnings 'once'" to disable false-positives
Some variables coming from the Subversion's Perl bindings are used
in our code only once, so the interpreter warns us about it.  These
warnings are false-positives, because the variables themselves are
initialized in the binding's guts, that are made by SWIG.

Credits to Sam Vilain for his note about "no warnings 'once'".

[ew: minor formatting change]

Signed-off-by: Eygene Ryabinkin <rea-git@codelabs.ru>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-16 20:33:13 -04:00
Eygene Ryabinkin 602015e0e6 git-svn: respect Subversion's [auth] section configuration values
Parameters 'store-passwords' and 'store-auth-creds' from Subversion's
configuration (~/.subversion/config) were not respected.  This was
fixed: the default values for these parameters are set to 'yes' to
follow Subversion behaviour.

Signed-off-by: Eygene Ryabinkin <rea-git@codelabs.ru>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 21:28:48 -04:00
Steven Walter 9ff74e95da Don't checkout the full tree if avoidable
In most cases of branching, the tree is copied unmodified from the trunk
to the branch.  When that is done, we can simply start with the parent's
index and apply the changes on the branch as usual.

[ew: rewritten from Steven's original to use SVN::Client instead
     of the command-line svn client.

     Since SVN::Client connects separately, we'll share our
     authentication providers array between our usages of
     SVN::Client and SVN::Ra, too.  Bypassing the high-level
     SVN::Client library can avoid this, but the code will be
     much more complex.  Regardless, any implementation of this
     seems to require restarting a connection to the remote
     server.

     Also of note is that SVN 1.4 and later allows a more
     efficient diff_summary to be done instead of a full diff,
     but since this code is only to support SVN < 1.4.4, we'll
     ignore it for now.]

Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-03 17:54:34 -07:00
Junio C Hamano 4f337e2466 Merge branch 'maint'
* maint:
  git-svn: don't attempt to spawn pager if we don't want one
  Supplant the "while case ... break ;; esac" idiom
  User Manual: add a chapter for submodules
  user-manual: don't assume refs are stored under .git/refs
  Detect exec bit in more cases.
  Conjugate "search" correctly in the git-prune-packed man page.
  Move the paragraph specifying where the .idx and .pack files should be
  Documentation/git-lost-found.txt: drop unnecessarily duplicated name.
2007-09-23 17:13:55 -07:00
Eric Wong b019304886 git-svn: don't attempt to spawn pager if we don't want one
Even though config_pager() unset the $pager variable, we were
blindly calling exec() on it through run_pager().

Noticed-by: Chris Moore <christopher.ian.moore@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-23 17:07:10 -07:00
Junio C Hamano 23d23385b3 Merge branch 'lh/svn-first-parent'
* lh/svn-first-parent:
  git-svn: always use --first-parent
  git-svn: add support for --first-parent
2007-09-14 22:37:43 -07:00
Eric Wong 7b02b85a66 git-svn: understand grafts when doing dcommit
Use the rev-list --parents functionality to read the parents
of the commit.  cat-file only shows the raw object with the
original parents and doesn't take into account grafts; so
we'll rely on rev-list machinery for the smarts here.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-09 02:30:33 -07:00
Eric Wong a51cdb0c04 git-svn: fix "Malformed network data" with svn:// servers
We have a workaround for the reparent function not working
correctly on the SVN native protocol servers.  This workaround
opens a new connection (SVN::Ra object) to the new
URL/directory.

Since libsvn appears limited to only supporting one connection
at a time, this workaround invalidates the Git::SVN::Ra object
that is $self inside gs_fetch_loop_common().  So we need to
restart that connection once all the fetching is done for each
loop iteration to be able to run get_log() successfully.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-07 22:23:48 -07:00
Lars Hjemli 4dbfe2e9bd git-svn: always use --first-parent
This makes git-svn unconditionally invoke git-log with --first-parent when
it is trying to discover its upstream subversion branch and collecting the
commit ids which should be pushed to it with dcommit. The reason for always
using --first-parent is to make git-svn behave in a predictable way when the
ancestry chain contains merges with other git-svn branches.

Since git-svn now always uses 'git-log --first-parent' there is no longer
any need for the --first-parent option to git-svn, so this is removed.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-06 22:53:16 -07:00
Lars Hjemli 05b4df3153 git-svn: add support for --first-parent
When git-svn uses git-log to find embedded 'git-svn-id'-lines in commit
messages, it can get confused when local history contains merges with
other git-svn branches. But if --first-parent is supplied to git-log,
working_head_info() will only see 'branch-local' commits and thus the
first commit containing a 'git-svn-id' line should refer to the correct
subversion branch.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-05 15:24:16 -07:00
Eric Wong 751eb39590 git-svn: fix dcommit clobbering upstream when committing multiple changes
Although dcommit could detect if the first commit in the series
would conflict with the HEAD revision in SVN, it could not
detect conflicts in further commits it made.

Now we rebase each uncommitted change after each revision is
committed to SVN to ensure that we are up-to-date.  git-rebase
will bail out on conflict errors if our next change cannot be
applied and committed to SVN cleanly, preventing accidental
clobbering of changes on the SVN-side.

--no-rebase users will have trouble with this, and are thus
warned if they are committing more than one commit.  Fixing this
for (hopefully uncommon) --no-rebase users would be more complex
and will probably happen at a later date.

Thanks to David Watson for finding this and the original test.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-31 23:22:51 -07:00
Junio C Hamano eeebd8d8c5 git-svn: Protect against "diff.color = true".
If the configuration of the user has "diff.color = true", the
output from "log" we invoke internally added color codes, which
broke the parser.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tested-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Acked-by: Eric Wong <normalperson@yhbt.net>
2007-08-31 23:22:51 -07:00
martin f. krafft 8f728fb96f git-svn init/clone --stdlayout option to default-init trunk/tags/branches
The --stdlayout option to git-svn init/clone initialises the default
Subversion values of trunk,tags,branches: -T trunk -b branches -t tags.
If any of the -T/-t/-b options are given in addition, they are given
preference.

[ew: fixed whitespace and added "-s" shortcut]

Signed-off-by: martin f. krafft <madduck@madduck.net>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-08-23 00:18:02 -07:00
Eric Wong 15d54753bb git-svn: dcommit prints out the URL to be committed to
This will print out the URL that dcommit will operate on.
If used with --dry-run this will print out the URL without
making changes to the repository.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-08-22 23:41:36 -07:00
Eric Wong 6ed77266c6 git-svn: fix log with single revision against a non-HEAD branch
Running git-svn log <ref> -r<rev> against a <ref> other than the
current HEAD did not work if the <rev> was exclusive to the
other branch.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-15 12:09:48 -07:00
Robert Ewald bf655fd700 git-svn: Translate invalid characters in refname
In git some characters are invalid as documented
in git-check-ref-format. In subversion these characters might
be valid, so a translation is required.

This patch does this translation by url escaping characters, that
are not allowed.

Credit goes to Eric Wong, martin f. krafft and Jan Hudec

Signed-off-by: Robert Ewald <robewald@gmx.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-30 17:49:50 -07:00
Richard MUSIL 575d025c0d git-svn: Minimalistic patch which allows svn usernames with space(s).
Changed filter for username in svn-authors file, so even 'user name' is accepted.

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-18 17:01:10 -07:00
Eric Wong 29633bb91c git-svn: fix commiting renames over DAV with funky file names
Renaming files with non-URI friendly characters caused
breakage when committing to DAV repositories (over http(s)).

Even if I try leaving out the $self->{url} from the return value
of url_path(), a partial (without host), unescaped path name
does not work.

Filenames for DAV repos need to be URI-encoded before being
passed to the library.  Since this bug did not affect file://
and svn:// repos, the git-svn test library needed to be expanded
to include support for starting Apache with mod_dav_svn enabled.

This new test is not enabled by default, but can be enabled by
setting SVN_HTTPD_PORT to any available TCP/IP port on
127.0.0.1.

Additionally, for running this test, the following variables
(with defaults shown) can be changed for the suitable system.
The default values are set for Debian systems:

  SVN_HTTPD_MODULE_PATH=/usr/lib/apache2/modules
  SVN_HTTPD_PATH=/usr/sbin/apache2

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-15 22:35:09 -07:00
Eric Wong 46cf98baa5 git-svn: remove leading slashes from fetch lines in the generate config
We were previously sensitive to leading slashes in the fetch
lines and incorrectly writing them to the config if the user
used them (needlessly) in the command-line.

This fixes the issue and allows us to play nicely with legacy
configs that have leading slashes in fetch lines.

Thanks to Bradford Smith for figuring this out for me:
>
> This works:
>
> git-svn clone https://my.server.net/repos/path/ -Ttrunk/testing
>   -ttags/testing -bbranches/testing testing
>
> This doesn't:
>
> git-svn clone https://my.server.net/repos/path -T/trunk/testing
>   -t/tags/testing -b/branches/testing testing

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-14 13:47:08 -07:00
Eric Wong 7730fbe624 git-svn: fix blocking with svn:// servers after do_switch
We now explicitly disconnect before starting new SVN::Ra
connections.  SVN::Ra objects will automatically be disconnected
from the server on DESTROY.

SVN servers seem to have problems accepting multiple connections
from one client, and the SVN library has trouble being connected
to multiple servers at once.  This appears to cause opening the
second connection to block, and cause git-svn to be unusable
after using the do_switch() function.

git-svn opens another connection because a workaround is
necesary for the buggy reparent function handling on certain
versions of svn:// and svn+ssh:// servers.  Instead of using the
reparent function (analogous to chdir), it will reopen a new
connection to a different URL on the SVN server.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-04 21:06:07 -07:00
Junio C Hamano 1fd81efad0 Merge branch 'ew/svn'
* ew/svn:
  git-svn: allow dcommit to retain local merge information
2007-07-02 01:46:22 -07:00
Junio C Hamano 0305b63654 Merge branch 'ei/worktree+filter'
* ei/worktree+filter:
  filter-branch: always export GIT_DIR if it is set
  setup_git_directory: fix segfault if repository is found in cwd
  test GIT_WORK_TREE
  extend rev-parse test for --is-inside-work-tree
  Use new semantics of is_bare/inside_git_dir/inside_work_tree
  introduce GIT_WORK_TREE to specify the work tree
  test git rev-parse
  rev-parse: introduce --is-bare-repository
  rev-parse: document --is-inside-git-dir
2007-07-01 13:10:42 -07:00
Junio C Hamano 8b4edcf04d Merge branch 'mk/svn'
* mk/svn:
  git-svn: honor ~/.subversion/ client cert file settings.
2007-06-30 23:48:54 -07:00
Sam Vilain 40cb8f8f08 git-svn: cache max revision in rev_db databases
Cache the maximum revision for each rev_db URL rather than looking it
up each time.  This saves a lot of time when rebuilding indexes on a
freshly cloned repository.

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-30 23:36:32 -07:00
Sam Vilain 3dfab993c8 git-svn: use git-log rather than rev-list | xargs cat-file
This saves a bit of time when rebuilding the git-svn index.

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-30 23:36:16 -07:00
Michael Krelin 6caf5b1891 git-svn: honor ~/.subversion/ client cert file settings.
Currently, whenever svn repository http server requests client
certificate, prompt provider is invoked, ignoring any
ssl-client-cert-file settings in ~/.subversion/servers.

Moreover, it happens more than once per session, which is quite
irritating.

Signed-off-by: Michael Krelin <hacker@klever.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-30 20:52:41 -07:00
Sam Vilain c5f71ad099 git-svn: avoid string eval for defining functions
You don't need to use string eval to define new functions; assigning a
code reference to the target symbol table is enough.

Acked-by: Eric Wong <normalperson@yhbt.net>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-16 01:20:26 -07:00
Eric Wong 733a65aa5d git-svn: allow dcommit to retain local merge information
dcommit will still rewrite the HEAD commit and the history of the first
parents of each HEAD~1, HEAD~2, HEAD~3 as it always has.

However, any merge parents (HEAD^2, HEAD^^2, HEAD~2^2) will now be
preserved when the new HEAD and HEAD~[0-9]+ commits are rewritten to SVN
with dcommit.  Commits written to SVN will still not have any merge
information besides anything in the commit message.

Thanks to Joakim Tjernlund, Junio C Hamano and Steven Grimm
for explanations, feedback, examples and test case.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-13 11:24:23 -07:00
Eric Wong 38570a47fc git-svn: reduce stat() calls for a backwards compatibility check
Also, this fixes a bug where in an odd case a remote named
"config" could get renamed to ".metadata".

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-13 11:23:51 -07:00
Eric Wong b54a901e05 git-svn: cleanup: factor out longest_common_path() function
I hadn't looked at this code in a while and had to read this
again to figure out what it did.  To avoid having to do this
again in the future, I just gave gave the hunk a descriptive
name.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-13 10:56:44 -07:00
Matthias Lederhofer 7ae3df8c0a Use new semantics of is_bare/inside_git_dir/inside_work_tree
Up to now to check for a working tree this was used:
	!is_bare && !inside_git_dir
(the check for bare is redundant because is_inside_git_dir
returned already 1 for bare repositories).
Now the check is:
	inside_work_tree && !inside_git_dir

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:07:53 -07:00
Matthias Lederhofer 493c774e58 rev-parse: introduce --is-bare-repository
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:07:53 -07:00
Eric Wong 7faf068660 git-svn: avoid md5 calculation entirely if SVN doesn't provide one
There's no point in calculating an MD5 if we're not going to use
it.  We'll also avoid the possibility of there being a bug in the
Perl MD5 library not being able to handle zero-sized files.

This is a followup to 20b3d206ac,
which allows us to track repositories that do not provide MD5
checksums.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-28 23:49:47 -07:00
James Y Knight 20b3d206ac Fix git-svn to handle svn not reporting the md5sum of a file, and test.
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-26 01:17:58 -07:00
Eric Wong dc431666d3 git-svn: don't minimize-url when doing an init that tracks multiple paths
I didn't have a chance to test the off-by-default minimize-url
stuff enough before, but it's quite broken for people passing
the --trunk/-T, --tags/-t, --branches/-b switches to "init" or
"clone" commands.

Additionally, follow-parent functionality seems broken when we're
not connected to the root of the repository.

Default behavior for "traditional" git-svn users who only track
one directory (without needing follow-parent) should be
reasonable, as those users started using things before
minimize-url functionality existed.

Behavior for users more used to the git-svnimport-like command
line will also benefit from a more-flexible command-line than
svnimport given the assumption they're working with
non-restrictive read permissions on the repository.

I hope to properly fix these bugs when I get a chance to in the
next week or so, but I would like to get this stopgap measure of
reverting to the old behavior as soon as possible.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-19 12:28:50 -07:00
Eric Wong 6442754d6c git-svn: avoid crashing svnserve when creating new directories
When sorting directory names by depth (slash ("/") count) and
closing the deepest directories first (as the protocol
requires), we failed to put the root baton (with an empty string
as its key "") after top-level directories (which did not have
any slashes).

This resulted in svnserve being in a situation it couldn't
handle and caused a segmentation fault on the remote server.

This bug did not affect users of DAV and filesystem repositories.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Confirmed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-19 12:26:36 -07:00
Eric Wong 4a1bb4c3f8 git-svn: don't attempt to minimize URLs by default
For tracking branches and tags, git-svn prefers to connect
to the root of the repository or at least the level that
houses branches and tags as well as trunk.  However, users
that are accustomed to tracking a single directory have
no use for this feature.

As pointed out by Junio, users may not have permissions to
connect to connect to a higher-level path in the repository.

While the current minimize_url() function detects lack of
permissions to certain paths _after_ successful logins, it
cannot effectively determine if it is trying to access a
login-only portion of a repo when the user expects to
connect to a part where anonymous access is allowed.

For people used to the git-svnimport switches of
--trunk, --tags, --branches, they'll already pass the
repository root (or root+subdirectory), so minimize URL
isn't of too much use to them, either.

For people *not* used to git-svnimport, git-svn also
supports:

 git svn init --minimize-url \
  --trunk http://repository-root/foo/trunk \
  --branches http://repository-root/foo/branches \
  --tags http://repository-root/foo/tags

And this is where the new --minimize-url command-line switch
comes in to allow for this behavior to continue working.
2007-05-13 12:10:43 -07:00
Eric Wong 4c03c3eb4e git-svn: fix segfaults due to initial SVN pool being cleared
Some parts of SVN always seem to use it, even if the SVN::Ra
object we're using is no longer used and we've created a new one
in its place.  It's also true that only one SVN::Ra connection
can exist at once...  Using SVN::Pool->new_default when the
SVN::Ra object is created doesn't seem to help very much,
either...

Hopefully this fixes all segfault problems users have been
experiencing over the past few months.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-05-13 12:10:42 -07:00
Eric Wong 0dc03d6a30 git-svn: clean up caching of SVN::Ra functions
This patch was originally intended to make the Perl GC more
sensitive to the SVN::Pool objects and not accidentally clean
them up when they shouldn't be (causing segfaults).  That didn't
work, but this patch makes the code a bit cleaner regardless

Put our caches for get_dir and check_path calls directly into
the SVN::Ra object so they auto-expire when it is destroyed.

dirents returned by get_dir() no longer needs the pool object
stored persistently along with the cache data, as they'll be
converted to native Perl hash references.

Since calling rev_proplist repeatedly per-revision is no longer
needed in git-svn, we do not cache calls to it.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-05-13 12:10:42 -07:00
Eric Wong 645833b564 git-svn: don't drop the username from URLs when dcommit is run
We no longer store usernames in URLs stored in git-svn-id lines
for dcommit, so we shouldn't rely on those URLs when connecting
to the remote repository to commit.
2007-05-13 12:10:42 -07:00
Karl Hasselström 171af11082 Add --no-rebase option to git-svn dcommit
git-svn dcommit exports commits to Subversion, then imports them back
to git again, and last but not least rebases or resets HEAD to the
last of the new commits. I guess this rebasing is convenient when
using just git, but when the commits to be exported are managed by
StGIT, it's really annoying. So add an option to disable this
behavior. And document it, too!

Signed-off-by: Karl Hasselström <kha@treskal.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-04 15:08:31 -07:00
Adam Roben b3cb7e4582 git-svn: Add 'find-rev' command
This patch adds a new 'find-rev' command to git-svn that lets you easily
translate between SVN revision numbers and git tree-ish.

Signed-off-by: Adam Roben <aroben@apple.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-30 15:58:37 -07:00
Junio C Hamano bcd8ee5b43 Fix symlink handling in git-svn, related to PerlIO
After reading the leading contents from a symlink data obtained
from subversion, which we expect to begin with 'link ', the code
forked to hash the remainder (which should match readlink()
result) using git-hash-objects, by redirecting its STDIN from
the filehandle we read that 'link ' from.  This was Ok with Perl
on modern Linux, but on Mac OS, the read in the parent process
slurped more than we asked for in stdio buffer, and the child
did not correctly see the "remainder".

This attempts to fix the issue by using lower level sysseek and
sysread instead of seek and read to bypass the stdio buffer.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Acked-by: Seth Falcon <sethfalcon@gmail.com>
2007-04-30 15:50:13 -07:00
Adam Roben 26e60160a0 git-svn: Added 'find-rev' command
This patch adds a new 'find-rev' command to git-svn that lets you easily
translate between SVN revision numbers and git tree-ish.

Signed-off-by: Adam Roben <aroben@apple.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-27 23:18:15 -07:00
Adam Roben 56973d20c1 git-svn: Ignore usernames in URLs in find_by_url
Usernames don't matter for the purposes of find_by_url, so always remove them
before doing any comparisons.

Signed-off-by: Adam Roben <aroben@apple.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-25 23:05:44 -07:00
Adam Roben b03c7a63a0 git-svn: Don't rely on $_ after making a function call
Many functions and operators in perl set $_, so its value cannot be relied upon
after calling arbitrary functions. The solution is simply to copy the value of
$_ into a local variable that will not get overwritten.

Signed-off-by: Adam Roben <aroben@apple.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-25 20:58:02 -07:00
Adam Roben ce11873921 Remove usernames from all commit messages, not just when using svmprops
Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Signed-off-by: Adam Roben <aroben@apple.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-24 21:40:17 -07:00
Eric Wong 0c1ec5a1f7 git-svn: don't allow globs to match regular files
git only tracks the histories of full directories, not
that of individual files.  Sometimes, SVN users will
place[1] a regular file in the directory designated
for subdirectories of branches or tags.

Thanks to jrockway on #git for pointing this out.

[1] mistakenly or otherwise, such as a README

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-18 12:39:04 -07:00
Eric Wong c284914a7c git-svn: quiet some warnings when run only with --version/--help
These are harmless but annoying.  They were introduced in
512b620bd9

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-17 03:33:22 -07:00
Eric Wong d627de6b13 git-svn: respect lower bound of -r/--revision when following parent
When an explicit --revision argument is specified, do not fetch
past the specified range into the beginning of history.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-17 03:33:22 -07:00
Eric Wong c16d08713e git-svn: fix log command to avoid infinite loop on long commit messages
This bug has been around since the the conversion to use the
Git.pm library back in October or November.  Eventually I'd like
"git rev-list/log" to have the option to not truncate overly
long messages.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-08 19:54:07 -07:00
Eric Wong 13c823fb52 git-svn: dcommit/rebase confused by patches with git-svn-id: lines
When patches are merged from another git-svn managed branch,
they will have the git-svn-id: metadata line in them (generated
by git-format-patch).

When doing rebase or dcommit via git-svn, this would cause
git-svn to find the wrong upstream branch.  We now verify
that the commit is consistent with the value in the .rev_db
file.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-08 19:53:54 -07:00
Eric Wong 512b620bd9 git-svn: bail out on incorrect command-line options
"git svn log" is the only command that needs the pass-through
option in Getopt::Long; otherwise we will bail out and let the
user know something is wrong.

Also, avoid printing out unaccepted mixed-case options (that
are reserved for the command-line) such as --useSvmProps
in the usage() function.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-08 19:53:42 -07:00
Eric Wong d6bad6610a git-svn: fail on rebase if we are unable to find a ref to rebase against
If we're on an invalid HEAD, we should detect this and avoid
attempting to continue.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-31 15:22:59 -07:00
Eric Wong a6a15a9958 git-svn: avoid respewing similar error messages for missing paths
We ignore errors if the path we're tracking did not exist for
a particular revision range, but we still print out warnings
telling the user about that.

As pointed out by Seth Falcon, this amounts to a lot of warnings
that could confuse and worry users.  I'm not entirely comfortable
completely silencing the warnings, but showing one warning per
path that we track should be reasonable.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-31 01:11:13 -07:00
Eric Wong 0b59451c1b git-svn: fix rel_path() when not connected to the repository root
This should fix fetching for people who did not use
"git svn --minimize" or cannot connect to the repository root
due to the lack of permissions.

I'm not sure what I was on when I made the change to the
rel_path() function in 4e9f6cc78e
that made it die() when we weren't connected to the repository
root :x

Thanks to Sven Verdoolaege for reporting this bug.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-25 18:01:28 -07:00
Eric Wong dee41f3e55 git-svn: add -l/--local command to "git svn rebase"
This avoids fetching new revisions remotely, and is usefuly
versus plain "git rebase" because the user does not have to
specify which remote head to rebase against.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-13 21:18:37 -07:00
Eric Wong 102a0a2db1 git-svn: fix show-ignore when not connected to the repository root
It was traversing the entire repository before.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-04 00:34:01 -08:00
Eric Wong 2e5e24803f git-svn: fix some potential bugs with --follow-parent
When using do_switch:

  We only need to ensure the index is clean and set to that of the
  parent tree) we rely on being able to reconstruct full files
  with deltas transferred over the network.

When using do_update:

  We may safely unlink the index if we are fetching an entire
  new tree with do_update.  Having an old index (from a
  previously deleted/abandoned directory) around can cause
  irrelevant files to be mistakenly kept.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 02:21:59 -08:00
Eric Wong e2c475d91c git-svn: fix reconnections to different paths of svn:// repositories
Clearing the pool of the previous SVN::Ra connection we have
seems to to fix mysterious connection dropping errors when
reconnecting to different paths of svn:// repositories hosted by
rubyforge.org.

Note: I'm not sure *why* this fixes things things,
but it does for me.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 01:59:34 -08:00
Eric Wong f30603fcf3 git-svn: fix clone when a target directory has been specified
Several bugs caused this to fail:

* GIT_DIR was set incorrectly after entering the target directory

* Avoid double chdir-ing when clone is called with an explicit path

* create target subdirectory *before* running git-init when using
  the multi-init path

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 01:26:26 -08:00
Sam Vilain 18ea92bd81 git-svn: don't consider SVN URL usernames significant when comparing
http://foo@blah.com/path is the same as http://blah.com/path, so
remove usernames from URLs before storing them in commits, and when
reading them from commits.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 01:01:02 -08:00
Eric Wong 5253dc33b7 git-svn: ensure we're at the top-level and can access $GIT_DIR
If we are run inside a subdirectory of a working tree, we'll
chdir to the top first before touching anything.  This also
prevents the accidental creation of .git directories inside
subdirectories since they need metadata.

Noticed by maio on #git

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong 1a97a50604 git-svn: give show-ignore HEAD smarts, like dcommit and log
This allows the user to run git-svn show-ignore on there
current HEAD without needing to remember which branch/ref they
branched from with -i.  Also, find_by_url should correctly
handle cases where the URL passed to it is not valid.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong 0dfaf0a4e1 git-svn: allow metadata options to be specified with 'init' and 'clone'
Since the options that affect the way metadata is handled in
git-svn, should be consistently set/unset throughout history
imported by git-svn; it makes sense to allow the user to set
certain options from the command-line that will write to the
config file when initially creating the repository.

Also, fix some formatting issues while we're updating
documentation.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong befc9adc0c git-svn: fix useSvmProps, hopefully for the last time
svm:mirror is not useful at all for us.  Parts of the old unit
test were broken and based on my misunderstanding of the
svm:mirror property.

When we read svm:source; make sure we correctly handle the '!'
in it: it is used to separate the path of the repository root
from the virtual path within the repository.  We don't need
to make that distinction, honestly!

We also ensure that subdirectories are also mirrored with the
correct URL if we're using useSvmProps.

We have a new test that uses dumped repo that was really
created using SVN::Mirror to avoid ambiguities and
mis-understandings about the svm: properties.

Note: trailing whitespace in the svm.dump file is unfortunately
a reality and required by SVN; so please ignore it when applying
this patch.

Also, ensure that the -R/--remote/--svn-remote flag is always
in effect if explicitly passed via the command-line.  This
allows us to track logically different mirrors sharing the
same URL (probably common with SVN::Mirror/SVK users).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong 62e349d235 git-svn: add support for using svnsync properties
This is similar to useSvmProps, but far simpler in
implementation because svnsync retains a 1:1
between revision numbers and relative paths within
the repository

Config keys: svn.useSvnsyncProps
             svn-remote.<repo>.useSvnsyncProps

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong aea736cc6d git-svn: allow overriding of the SVN repo root in metadata
This feature allows users to create repositories from alternate
URLs.  For example, an administrator could run git-svn on the
server locally (accessing via file://) but wish to distribute
the repository with a public http:// or svn:// URL in the
metadata so users of it will see the public URL.

Config key: svn-remote.<remote>.rewriteRoot

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong 0425ea9088 git-svn: add 'clone' command, an alias for init + fetch
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong b7e5348c7f git-svn: hide the private git-svn 'config' file as '.metadata'
Having it named as 'config' prevents us from tracking a
ref named 'config', which is a huge mistake.

On the non-technical side, the word 'config' implies that
a user can freely modify it; but that's not the case
here.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong d6d3346bab git-svn: fix some issues for people migrating from older versions
* Fixed logic for renaming old .rev_db -> .rev_db.$uuid

 * correctly handle manual migrations for those who decide to
   start use globbing to handle branches/tags over individual
   'fetch' keys

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong 905f8b7dfc git-svn: add a 'rebase' command
This works similarly to 'svn update' or 'git pull' except that
it preserves linear history with 'git rebase' instead of 'git
merge' for ease of dcommit-ing with git-svn.

While we're at it, put the working_head_info() logic
into its own function and allow --fetch-all/--all for
dcommit and rebase (which will fetch all refs in the
current [svn-remote] instead of just the working one).

Note that the '-a' switch (short for --fetch-all/--all) has been
removed as it conflicts with the non-svn 'git fetch'

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong 1e889ef36c git-svn: checkout files on new fetches
On newly-created repositories, 'refs/heads/master' does not
point to anything.  This can be confusing to new users; so we
update 'master' to point to the last imported ref after fetching
is done.

Once 'master' is valid; we assume HEAD points to it; and if
the repository is not bare, then checkout the files if the
working tree is clean and unused.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong 488a63ec23 git-svn: add support for --stat in the log command
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong a836a0e172 git-svn: documentation updates for new functionality
Force the showing of the --minimize flag as an option in the
'migrate' help.

Also, fix the usage function to correctly filter out
the deprecated aliases.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong 60d9c97adf git-svn: allow dcommit for those who only fetch from SVM with useSvmProps
This allows users to use SVM (SVN::Mirror) to mirror a remote
repository to use dcommit to commit to the repository that SVM
was mirroring.  When dcommit is used in this manner, the automatic
fetch + rebase/reset does not happen; in which case the user will
have to manually invoke svm/svk, run 'git svn fetch', and finally
'git rebase'.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong 7447b4bc83 git-svn: error checking for invalid [svn-remote "..."] sections
We don't end up trying to pass an undef URL over to SVN::Ra->new
because it'll segfault.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong e8d120bd5a git-svn: remember to check for clean indices on globbed refs, too
Also, warn about dirty indices and avoid an unncessary
write-tree call if the index is clean.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong 6af1db447b git-svn: allow --log-window-size to be specified, default to 100
The newer default value should should lower memory usage for
large fetches and also help with fetching from less reliable
servers.  Previously the value was 1000 and memory usage
got a bit high on some repositories and fetching became
less reliable in some cases.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong b4d57e5ea3 git-svn: simplify the (multi-)init methods of fetching
Also, some changes to avoid creating dead dirs under
.git/svn/.  We now create all directories as late as
possible.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong 28710f74ea git-svn: brown paper bag fixes
* avoid skipping modification-only changes in fetch
  * correctly fetch when we only have branches and tags
    to glob from (no fetch keys defined)

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong dadc6d2a09 git-svn: allow 'init' to act as multi-init
multi-init is now just an alias that requires -T/-t/-b;
all options that 'init' can now accept.

This will hopefully simplify usage and reduce typing.

Also, allow the --shared option in 'init' to take an optional
argument now that 'git-init --shared' supports an optional
argument.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong e98671e5c2 git-svn: hopefully make 'fetch' more user-friendly
multi-fetch is deprecated, "fetch -a" is easier to type
By default, fetch will fetch everything from its default
[svn-remote]; if fetch [--all|-a] is specified, then it will
fetch from all svn remotes.  Refspecs on the command-line
(like git-fetch) are not supported.

Also, enable -r/--revision arguments for fetch so
users can shoot themselves in the foot^W^W^W^W^W
skip some history and do the equivalent of a shallow
clone/fetch they're not interested in.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong 3bc718ba66 git-svn: usability fixes for the 'git svn log' command
Similar in spirit to the recent dcommit change, we now
look at 'HEAD' by default to look for a GIT_SVN_ID
so the user won't have to pass -i <GIT_SVN_ID> argument.

We are also more tolerant of of people passing bare remote names
as a result (just $GIT_SVN_ID without the -i)

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong ce207c7ad1 git-svn: include merges when calling rev-list for decommit
Merge commits can be created when following certain parents,
(most notably 'R' cases) and we definitely don't want to exclude
them.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong a8ae26235c git-svn: make dcommit usable for glob users
* dcommit no longer requires the correct -i/GIT_SVN_ID option
   passed to it.  Since you're committing from HEAD (or another
   commit that is a parent of HEAD), you'll be able to find
   a commit with metadata information containing the SVN URL
   that your HEAD was descended from anyways.

 * I don't think dcommit ever worked for people using the
   noMetadata option; so I don't think relying on metadata
   is an issue.

 * useSvmProps users shouldn't commit to SVN::Mirror created
   repositories anyways, right?

 * Users of globbing should automatically be able to commit
   to paths that are not explicitly set in .git/config

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong db03cd24a1 git-svn: handle multi-init without --trunk, UseSvmProps fixes
multi-init did not write a svn-remote.<remote>.url config
entry without a --trunk argument.

Also, The svm:mirror property is used by SVN::Mirror to track
the path of the repository that we are mirroring.  We need to
append that to the source (which is (presumably) just the URL of
the repository root).

Lastly, we now look harder for svm:(source|mirror|uuid) properties
in sub and parent directories.  Since our relative path could
be tweaked.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong c3560e535c git-svn: write the highest maxRex out for branches and tags
Even if nothing touched paths we care about in a fetch;
increment the maxRev like we do with rev_db since
we don't like having to run get_log on revisions we've
seen before.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong 26a62d57a2 git-svn: use separate, per-repository .rev_db files
We need a separate .rev_db file for each repository we're
tracking.  This allows us to track the same logical path off
multiple mirrors.  We preserve a symlink to the old .rev_db
(no-UUID) if we're (auto-)migrating from an old version to
preserve backwards compatibility.

Also, get rid of the uuid() wrapper since we cache UUID in our
private config, and the SVN::Ra::get_uuid() function memoizes
the return value per-connection.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong 97ae091169 git-svn: extra safety for noMetadata and useSvmProps users
Make sure we flush our userspace buffers and and fsync(2)
.rev_db information to disk if we use these options because
we really don't want to lose this information.

Also, disallow --use-svm-props and --no-metadata from the
command-line because history will be inconsistent if they're
only used occasionally.  If a user wants to use these options,
they must be set in the config so they're always on.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong 93f2689ccd git-svn: use private $GIT_DIR/svn/config file more
Switch max_rev storage over to using it for globbing
branches and tags.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong 91b03282b5 git-svn: add support for per-[svn-remote "..."] options
Available options are currently:

  svn-remote.<remote>.{noMetadata,useSvmProps,followParent}

These boolean switches will override options set globally in
[svn], and even override options set on the command-line (this
should probably change in the future, however).

Note that the noMetadata and useSvmProps options conflict.  It's
both technically and logically impossible to use them together.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong 8a49ee9759 git-svn: add support for SVN::Mirror/svk using revprops for metadata
Pass --use-svm-props or set the svn.usesvmprops key with git-config
to enable using properties set by SVN::Mirror when it mirrored the
upstream URL.

This is heavily based on work from Sam Vilain:
> From: Sam Vilain <sam@vilain.net>
> Date: Sun, 11 Feb 2007 12:34:45 +1300
> Subject: [PATCH] git-svn: re-map repository URLs and UUIDs on SVK mirror paths
>
> If an SVN revision has a property, "svm:headrev", it is likely that
> the revision was created by SVN::Mirror (a part of SVK).  The property
> contains a repository UUID and a revision.  We want to make it look
> like we are mirroring the original URL, so introduce a helper function
> that returns the original identity URL and UUID, and use it when
> generating commit messages.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong 490f49ea58 git-svn: remove optimized commit stuff for set-tree
I may resurrect it for dcommit at some point, but nobody really
uses set-tree anymore and I don't feel like introducing more
complexity into the code at this point.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong 74a81227f9 git-svn: correctly handle globs with a right-hand-side path component
Several bugs were found and fixed while getting this to work:

 * Remember the 'R'(eplace) case of actions and treat it like we
   would an 'A'(dd) case.

 * Fix a small case of follow-parent missing a parent if a
   subdirectory was modified in the revision where the parent was
   copied.

 * dirents returned by get_dir sometimes expire if the data
   structure is too big and the pool is destroyed, so we
   cache get_dir (along with check_path and get_revprops)
   temporarily along with its pool.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong 9e3cdbd4f2 git-svn: correctly handle the -q flag in SVN::Git::Fetcher
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong 4e9f6cc78e git-svn: fix buggy regular expression usage in several places
I incorrectly used $path/? and $path/* to strip off leading
directories, but places where $path = 'branches/0.17' would
incorrectly strip changes to 'branches/0.17.1' as well.

For globs, we require that our '*' is its own path component
(surrounded by '/' or nothing).  Enforce this when --prefix= is
passed to us, too.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:12 -08:00
Eric Wong 0bed5eaa0e git-svn: enable follow-parent functionality by default
--no-follow-parent disables and reverts it back to the old
default behavior of not following parents (if you don't care for
full history).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong e20bea6545 git-svn: remove some noisy debugging messages
We don't need them anymore, all the rough points of
the --follow-parent implementation have been worked out.

The only improvement in the future will probably be
--follow-parent-harder, which will track subdirectories and
follow individual file history (so annotate/blame can be
complete); but that is still a ways off.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong d542aedb94 git-svn: remove check_path calls before calling do_update
These checks were needed before git-svn got smarter about
match_paths() and using path information returned by get_log().
We also have extra checking against fetching revisions
out-of-order these days; so we don't have to worry about that as
much.  We also check for tree deletions in match_paths() and
skip those as well.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong b9dffd8cad git-svn: --follow-parent tracks multi-parent paths
We can have a branch that was deleted, then re-added under the
same name but copied from another path, in which case we'll have
multiple parents (we don't want to break the original ref, nor
lose copypath info).

Add a test for this, too, of course.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong e518192f3b git-svn: implement auto-discovery of branches/tags
This is similar to the way git proper handles refs, except we
use the keys 'branches' and 'tags' to distinguish when we want
to use wildcards.

The left-hand side of the ':' contains the remote path, and must
have one asterisk ('*') in it for the branch name.  The asterisk
may be in any component of the path as long as is it on its own
directory level.

The right-hand side contains the refname and must have the
asterisk as the last path component.

        branches = branches/*:refs/remotes/*
        tags = tags/*:refs/remotes/tags/*

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong d2ae14346c git-svn: run get_log() on a sub-directory if possible
This is an optimization that should conserve network
bandwidth on certain repositories and configurations.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong fbcc1737d6 git-svn: reintroduce using a single get_log() to fetch
We'll need to rely on path matching to handle wildcard support for branches and
tags.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong 4bb9ed0466 git-svn: prepare multi-init for wildcard support
Update the tests since we no longer write so many things to the
config.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong 9fa00b655c git-svn: just name the default svn-remote "svn" instead of "git-svn"
It can be confusing and redundant, since historically the
default remote ref (not remote itself) has been "git-svn", too.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong 502c1bf629 git-svn: avoid extra get_log calls when refspecs are added for fetching
Since fetch_loop_common starts from the lowest revision number
in a group of Git::SVN objects; we want to avoid refetching
get_log for current users for things we've already cut it.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong ef70de9685 git-svn: get rid of revisions_eq check for --follow-parent
This was originally needed before we used the delta fetcher and
had a less-clean follow-parent implementation that could leave
holes in the history.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong 471bc00052 git-svn: migrations default to [svn-remote "git-svn"]
It looks better (like [remote "origin"]) instead of whatever
refname came up first in our directory traversal.  Of course
--remote= overrides this.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong 88cf4107eb git-svn: save paths to tags/branches with for future reuse
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong d8115c5104 git-svn: don't write to the config file from --follow-parent
Having 'fetch' entries in the config file created from
--follow-parent is wasteful because it can cause *future* of
invocations to follow revisions we were never interested in
in the first place.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong ce4b4af7ff git-svn: use sys* IO functions for reading rev_db
Using buffered IO for reading 40-41 bytes at a time isn't very
efficient.  Buffering writes for a short duration is alright
since we close() right away and buffers will be flushed.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong 9c93fee51e git-svn: avoid redundant get_log calls between invocations
Prefill .rev_db to the maximum revision we tried to fetch;
and take advantage of that so we can avoid using get_log()
on ranges we've already seen (and have deemed uninteresting).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong 373274f978 git-svn: do our best to ensure that our ref and rev_db are consistent
Defer any signals that cause termination while they are
updating; and put the update-ref call as close to the rename()
as possible.  Also, make things extra-safe (but slower) for
people using --no-metadata since they can't rely on .rev_db
being rebuilt if it's clobbered (well, I'm calling update-ref
with the -m flag for reflogs, we don't yet have a way to rebuild
.rev_db from reflogs.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong ecc712ddc4 git-svn: re-enable repacking flags
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong 47a0b75e01 git-svn: avoid a huge memory spike with high-numbered revisions
Passing very large strings as arguments is bad for memory usage
as it never seems to get freed in Perl.  The .rev_db format is
already not optimized for projects with sparse history.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong d4eff2bda5 git-svn: make (multi-)fetch safer but slower
get_log with explicit paths is the safest way to get revisions
that change a particular path we're interested in.
Unfortunately that means we still have to run get_log multiple
times for each path we're interested in, and even more if
a path gets deleted.

The first argument of get_log() is an array reference, but we
shouldn't use more than one element in that array ref because
the non-existence of _one_ of those paths for a particular range
would cause an error for all paths in that range, so yes, we
need multiple get_log calls to be on the safe side...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong c7eba7163b git-svn: gracefully handle --follow-parent failures
We don't always know that a path will exist at a particular
revision.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong 9760adcccc git-svn: reinstate --no-metadata, add --svn-remote=, variable cleanups
--svn-remote allows the default remote name to be overridden (useful
for tracking multiple SVN repositories).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:11 -08:00
Eric Wong 8a603774de git-svn: fix several fetch bugs related to repeated invocations
We no longer delete the top-level directory even if it got
deleted from the upstream repository.  In gs_do_update; we
double-check that the path we're tracking exists at both
endpoints before proceeding.  We have also added additional
protection against fetching revisions out-of-order.

To simplify our internal interfaces, I've disabled passing the
'recursive' flag to the gs_do_{switch,update} wrapper functions
since we always want it in git-svn.  We also pass the
entire Git::SVN object rather than just the path because it
helped me debug.

When printing progress, the refname is printed out to make
it less confusing when multi-fetch is running.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong f0ecca1041 git-svn: remove the 'rebuild' command and make the functionality automatic
Since refs/remotes/* are not automatically cloned, we expect the
user to be capable of copying those references themselves
anyways.

Also removed the documentation for --ignore-nodate while we're
at it; it has also been made automatic.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong 289370578c git-svn: fetch tracks initial change with --follow-parent
We were still skipping path information from get_log if we are
tracking /r9270/drunk/subversion/bindings/..., but got something
like this in the log:

   A /r9270/drunk (from /r9270/trunk:14)

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong 5d3b7cd5fe git-svn: don't rely on do_switch + reparenting with svn(+ssh)://
I can't seem to figure out what I or the SVN libraries are doing
wrong, but it appears to be related to reparent and probably
some global structure that gets reset if multiple SVN
connections are being used.

So now, in order to use do_switch; we'll open a new connection
to the repository with the complete URL; but we can't seem to
ever use an existing Ra object after another one has been
created...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong f7c3fc4a26 git-svn: reinstate the default SVN error handler after using get_log
We don't need our own error handler for other operations.  Also
add a message about the successfully do_switch or do_update in
follow-parent for debugging do_switch failures with svn:// and
svn+ssh:// connections.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong 90c1b15da3 git-svn: just use Digest::MD5 instead of requiring it
Historically, git-svn did not always use Digest::MD5 because
it did not use the SVN::Delta::Editor interfaces.  Nowadays
it does, and the requires make strace more noisy.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong 24e22aa8a5 git-svn: cleanup: move editor-specific variables into the editor namespace
Also removed some unused/redundant functions.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong ce2a0f2f9d git-svn: stop using path names as refnames with --follow-parent
Using path names as refnames breaks horribly if a user is
tracking one large, toplevel directory, and a lower-level
directory is followed from another project is a parent
of another ref, as it will cause refnames such as:
'refs/remotes/trunk/path/to/stuff', which will conflict
with a refname of 'refs/remotes/trunk'.

Now we just append @$revno to the end of it the current
refname.  And if we have followed back to a grandparent, then
we'll strip any existing '@$parent_revno' strings before
appending our own '@$revno' string to it.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong 2b27f6c884 git-svn: correctly handle do_{switch,update} in deep directories
The do_update or do_switch functions in SVN only allow for a
single path component; so 'path/to/deep/dir' would be
interpreted as 'path'.

SVN 1.4.x has a reparent function that can let us change the
session to use a higher-level root of the repository, so we can
use that for do_switch (which still doesn't seem to work in SVN
1.4.3 (a fix was attempted, but they missed the rest of the
typemap changes needed in trunk...)).

On the do_update side, we can use set_path on higher level
directories and set them to a newer revision so they don't get
updated.  We can't do this with do_switch, either, because the
relative path we're tracking can change (directory moving into
a child of itself).

Because of these changes, we need to double check that our Fetch
editor is correctly performing stripping on any prefixed paths
from update, otherwise we'll just die() because that would be
a bug.

Added a test case which helped me notice and fix problems with
do_switch, too.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong 2fa6a23efb git-svn: correctly track diff-less copies with do_switch
Also, this should allow for the tracking of new, but empty
directories where we would want to see the log message.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong 0af9c9f94a git-svn: allow multi-fetch to fetch things chronologically
Since single fetching is a special case of multi-fetch,
share code with it and the fetch loop into Git::SVN::Ra
since it uses a single Ra connection and multiple
Git::SVN objects.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong 21819a3708 git-svn: cleanup remove unused function
Also move tz_to_s_offset into Git::SVN::Log since that's
the only place it's used now.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong 6139535436 git-svn: simplify usage of the SVN::Git::Editor interface
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong 6e8548cca8 git-svn: avoid an extra svn_ra connection during commits
Before, we needed a separate svn_ra instance to run
our check_path calls once the editor was active; but
we can avoid that by running all the check_path calls
before our editor is active.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong d3a840dc74 git-svn: fix committing to subdirectories, add tests
I broke this part with the URL minimization; since
git-svn will now try to connect to the root of
the repository and will end up writing files
there if it can...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong 3ebe8df7f6 git-svn: fix segfaults from accessing svn_log_changed_path_t
svn_log_changed_path_t structs were being used out of scope
outside of svn_ra_get_log (because I wanted to eventually be
able to use git-svn with only a single connection to the
repository).  So now we dup them into a hash.

This was fixed while making --follow-parent fetches more
efficient.  I've moved parsing of the command-line --revision
argument outside of the Git::SVN module so Git::SVN::fetch() can
be used in more places (such as find_parent_branch).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong e5a0b240fc git-svn: correctly track revisions made to deleted branches
git-svn has never been able to handle deleted branches very well
because svn_ra_get_log() is all-or-nothing, meaning that if the
max revision passed to it does not contain the path we're
tracking, we miss all the revisions in the repository.

Branches fetched using --follow-parent still do this
sub-optimally (will be fixed soon).  --follow-parent will soon
become the default, so we will assume that when using get_log();

We will also avoid tracking revprops for revisions with no
path-related changes since otherwise we just end up pulling
logs to paths we don't care about.

Also added a test for this to t9104-git-svn-follow-parent.sh and
correctly commit the log message in the preceeding test (which
conflicted with a filename).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong 97f6987afa git-svn: avoid tracking change-less revisions
They simply aren't interesting to track, and this will allow
us to avoid get_log().

Since r0 is covered by this, we need to update the tests to not
rely on r0 (which is always empty).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong ef3cfaad19 git-svn: track writes writes to the index in fetch
Introducing Git::IndexInfo.  This module will probably be useful
outside of git-svn, so I'm not putting it in the Git::SVN
namespace.

This will allow me to more easily avoid the use of get_log() in
the future and simply run do_update in incrementing ranges.
get_log() should be avoided because there are cases where
moved/deleted directories do not track correctly (until
--follow-parent is run on a new branch).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong 7f578c55af git-svn: --follow-parent now works on sub-directories of larger branches
This means that tracking the path of:

  /another-larger/trunk/thunk/bump/thud inside a repository

would follow:

  /larger-parent/trunk/thunk/bump/thud

even if the svn log output looks like this:
  --------------------------------------------
  Changed paths:
     A /another-larger (from /larger-parent:5)
  --------------------------------------------

Note: the usage of get_log() in git-svn still makes a
an assumption that shouldn't be made with regard to
revisions existing for a particular path.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:10 -08:00
Eric Wong e6434f8760 git-svn: 'init' attempts to connect to the repository root if possible
This allows connections to be used more efficiently and not require
users to run 'git-svn migrate --minimize' for new repositories.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong 9bf046372b git-svn: better error reporting if --follow-parent fails
This will be useful to me when I try more special-cases
of parent-tracking.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong 536c4b0937 git-svn: allow 'init' to work outside of tests
Tests always ran 'git init' before we ran so that repo-config
would always have something to read.  However that does not work
in real-world situations where the user expects 'git svn init'
to work without running 'git init' first.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong 07a1c95045 git-svn: get rid of additional fetch-arguments
It's not really useful anymore now that we have a better
--follow-parent for the valid cases.  Any other use
of it is not valid.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong a2003abc23 git-svn: allow --follow-parent on deleted directories
Any operations on the index in Git::SVN that is not wrapped by
tmp_index_do() is wrong.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong b805b44a92 git-svn: disallow ambigious local refspecs
Having multiple fetch refspecs pointing to the same local ref
would be a very bad thing.  Start avoiding the use of fatal() or
exit() inside the modules so we can libify more easily.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong 8b8fc06824 git-svn: --follow-parent works with svn-remotes multiple branches
Bugs fixed:

 * We didn't allow manually (not using git-svn) init-ed
   remotes/fetch refspecs to be used before.  It works now
   because that's what I did in this test.  git-svn init should
   offer more control in the future.
 * correctly strip paths in the delta editor when using
   do_switch().
 * Make the -i / GIT_SVN_ID option work correctly when doing
   fetch on a multi-ref svn-remote

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong 15710b6f34 git-svn: fix --follow-parent to work with Git::SVN
While we're at it, beef up the test because I was
getting false-passes during development.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong 47e39c55c9 git-svn: enable --minimize to simplify the config and connections
--minimize will update the git-svn configuration to attempt to
connect to the repository root (instead of directly to the
path(s) we are tracking) in order to allow more efficient reuse
of connections (for multi-fetch and follow-parent).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong f6f0987646 git-svn: reuse open SVN::Ra connections by URL
Note: this can cause problems with Perl's reference counting GC,
so I'm disabling Git::SVN::Ra::DESTROY.  If we notice more
problems down the line, we can disable this enhancement.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong 780a2f58e7 git-svn: fix a regression in dcommit that caused empty log messages
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong 706587fc6d git-svn: add support for metadata in .git/config
Of course, we handle metadata migrations from previous versions
and we have added unit tests.

The new .git/config remotes resemble non-SVN remotes.  Below
is an example with comments:

[svn-remote "git-svn"]
	; like non-svn remotes, we have one URL per-remote
	url = http://foo.bar.org/svn

	; 'fetch' keys are done in the same way as non-svn
	; remotes, too.  With the left-hand-side of the ':'
	; being the remote (SVN) repository path relative to the
	; above 'url' key; and the right-hand-side being a
	; remote ref in git (refs/remotes/*).
	; An empty left-hand-side means that it will fetch
	; the entire contents of the 'url' key.
	; old-style (migrated from previous versions of git-svn)
	; are like this:
	fetch = :refs/remotes/git-svn

	; this is created by a current version of git-svn
	; using the multi-init command with an explicit
	; url (specified above).  This allows multi-init
	; to reuse SVN::Ra connections.
	fetch = trunk:refs/remotes/trunk
	fetch = branches/a:refs/remotes/a
	fetch = branches/b:refs/remotes/b
	fetch = tags/0.1:refs/remotes/tags/0.1
	fetch = tags/0.2:refs/remotes/tags/0.2
	fetch = tags/0.3:refs/remotes/tags/0.3

[svn-remote "alt"]
	; this is another old-style remote migrated over
	; to the new config format
	url = http://foo.bar.org/alt
	fetch = :refs/remotes/alt

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong d05d72e07e git-svn: remove graft-branches command
It's becoming a maintenance burden.  I've never found it
particularly useful myself, nor have I heard much feedback about
it; so I'm assuming it's just as useless to everyone else.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong 1ce255dc16 git-svn: convert 'set-tree' command to use Git::SVN
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong d7ad3bed8c git-svn: switch dcommit to using Git::SVN code
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong 1c8443b050 git-svn: fetch/multi-fetch converted over to Git::SVN module
--follow-parent and commit-diff are currently broken with
this commit...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong 396988e0b9 git-svn: get rid of Memoize for now...
I may refactor more of this stuff into separate modules
2007-02-23 00:57:09 -08:00
Eric Wong 44320b9e0e git-svn: convert the 'commit-diff' command to Git::SVN
Also, convert all usage of 'log_msg' to 'log_entry' for
consistency's sake

SVN::Git::Editor::apply_diff now drives the rest of the
editor.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong c843c464b8 git-svn: do not let Git.pm warn if we prematurely close pipes
This mainly quiets down warnings when running git svn log.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong e7f023c81a git-svn: port the 'rebuild' command to use Git::SVN objects
Also correctly shared some variables needed for Git::SVN::Log

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong f8c9d1d27f git-svn: moved the 'log' command into its own namespace
More cleanup to separate out functionality and make things
nicer to hack on.

While we're at it, centralize loading of the authors into
one place and correctly handle '(no author)' cases in
when showing logs after-the-fact; and not just at commit
time.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong 5969cbe13c git-svn: convert show-ignore over to Git::SVN
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:09 -08:00
Eric Wong e7db67e6f1 git-svn: make multi-init capable of reusing the Ra connection
If a user specified a seperate URL and --tags/--branches as
a sepearte URL, allow the Ra object (and therefore the connection)
to be reused.

We'll get rid of libsvn_ls_fullurl() since it was only used
in one place.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:08 -08:00
Eric Wong 8164b6525e git-svn: convert multi-init over to using Git::SVN
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:08 -08:00
Eric Wong d2866f9e1f git-svn: convert 'init' to use Git::SVN
While we're at it, fix up some bugs in Git::SVN.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:08 -08:00
Eric Wong 9b981fc659 git-svn: add Git::SVN module (to avoid global variables)
This should make it easier to improve multi-fetch and
--follow-parent by avoiding global variables.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:08 -08:00
Eric Wong 336f1714ae git-svn: cleanup: avoid re-use()ing Git.pm in sub-packages
I will be using functions from Git.pm in more modules, so I
want to avoid re-importing the long argument list everywhere
it's used.

Also removed an unused command-line switch
(--no-ignore-externals) and some variables.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:08 -08:00
Eric Wong d81bf82719 git-svn: cleanup: put SVN workarounds into their own namespace
Force some svn_ra functions to use a temporary pool via wrapper

This cleans up the code a bit by removing explicit instances of
pool allocation and deallocation and providing wrapper functions
that make use of temporary pools.

I've also added an explicit pool usage when creating the commit
editor for commit-diff where get_commit_editor can be called
multiple times with the same pool previously.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:08 -08:00
Eric Wong 4a87db0e12 git-svn: cleanup: move process_rm around
(it's only used in one function now)

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:08 -08:00
Eric Wong d976acfd89 git-svn: move authentication prompts into their own namespace
I'm going to be reorganizing some more code.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:08 -08:00
Eric Wong 7774284ac7 git-svn: correctly handle boolean options via git-config
We don't append a space after '--bool', so we can't expect
a regular expression to match the space.

Semi-noticed by Junio C Hamano :)

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-10 22:48:18 -08:00
Eric Wong 22600a2515 git-svn: do not let Git.pm warn if we prematurely close pipes
This mainly quiets down warnings when running git svn log.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-01 21:51:36 -08:00
Tom Prince e0d10e1c63 [PATCH] Rename git-repo-config to git-config.
Signed-off-by: Tom Prince <tom.prince@ualberta.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-28 16:16:53 -08:00
Eric Wong cea70cf881 git-svn: remove leading slash when printing removed directories
Not sure why it was there in the first place, we always do our
work relative to the URL we're connected to; even if that URL is
the root of the repository, so the leading slash is pointless...
Lets be consistent when printing things for the user to see.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-22 13:15:50 -08:00
Eric Wong 6f729591d1 git-svn: print and flush authentication prompts to STDERR
People that redirect STDOUT output should always see STDERR
prompts interactively.

STDERR should always be flushed without buffering, so
they should always show up.  If that is unset, we still
explicitly flush by calling STDERR->flush.

The svn command-line client prompts to STDERR, too.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-15 22:30:42 -08:00
Nicolas Pitre 5c94f87e6b use 'init' instead of 'init-db' for shipped docs and tools
While 'init-db' still is and probably will always remain a valid git
command for obvious backward compatibility reasons, it would be a good
idea to move shipped tools and docs to using 'init' instead.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-12 13:36:16 -08:00
Eric Wong 9a5e4075a4 git-svn: pass an unambiguous ref to rev-list when grafting-branches
Some users apparently create local heads with the same basename
as the remote branch they're tracking.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07 21:32:49 -08:00
Eric Wong ae41098714 git-svn: add --prefix= option to multi-init
Also, document --{trunk,branches,tags} options while we're
documenting multi-init options.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07 21:32:49 -08:00
Eric Wong fffe694d60 git-svn: fix show-ignore
Looks like I broke it in 747fa12cef
but never noticed.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:48:48 -08:00
Eric Wong 2a3240beaa git-svn: make --repack work consistently between fetch and multi-fetch
Since fetch reforks itself at most every 1000 revisions, we
need to update the counter in the parent process to have a
working count if we set our repack interval to be > ~1000
revisions.  multi-fetch has always done this correctly
because of an extra process; now fetch uses the extra process;
as well.

While we're at it, only compile the $sha1 regex that checks for
repacking once.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-04 22:28:46 -08:00
Eric Wong 98327e5891 git-svn: make multi-init less confusing
It now requires at least one of the (trunk|branch|tags) arguments
(either from the command-line or in .git/config).  Also we make
sure that anything that is passed as a URL ('help') in David's
case is actually a URL.

Thanks to David Kågedal for reporting this issue.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-04 22:28:46 -08:00
Eric Wong 4a4d94b29b git-svn: sort multi-init output
This looks a bit more pleasant for users.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-28 01:39:47 -08:00
Eric Wong 2c5c1d5300 git-svn: verify_ref() should actually --verify
Not sure how I missed this the first time around...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-28 01:39:38 -08:00
Eric Wong 7d60ab2c15 git-svn: print out the SVN library version in --version, too
This could be useful in finding new problems and helping users
debug.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-28 01:39:30 -08:00
Eric Wong ed92f17026 git-svn: remove non-delta fetch code paths
We have less code to worry about now.  As a bonus, --revision
can be used to reliably skip parts of history whenever fetch is
run, not just the first time.  I'm not sure why anybody would
want to skip history in the middle, however...

For people (nearly everyone at the moment) without the
do_switch() function in their Perl SVN library, the entire tree
must be refetched if --follow-parent is used and a parent is
found.  Future versions of SVN will have a working do_switch()
function accessible via Perl.

Accessing repositories on the local machine (especially file://
ones) is also slightly slower as a result; but I suspect most
git-svn users will be using it to access remote repositories.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-28 01:39:09 -08:00
Eric Wong c3a41037ed git-svn: dcommit should diff against the current HEAD after committing
This is a followup to dd31da2fdc.
Regardless of whether we commit an alternate head, we always
diff-tree based on the current HEAD, and rebase against our
remote reference as necessary.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-26 16:45:22 -08:00
Eric Wong 4b1552238e git-svn: enable common fetch/commit options for dcommit
dcommit does commits and fetches, so all options used for those
should work, too, including --authors-file.

Reported missing by Nicolas Vilz.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-22 23:14:58 -08:00
Eric Wong 3289e86e1e git-svn: rename 'commit' command to 'set-tree'
'set-tree' probably accurately describes what the command
formerly known as 'commit' does.

I'm not entirely sure that 'dcommit' should be renamed to 'commit'
just yet...  Perhaps 'push' or 'push-changes'?

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-16 05:17:56 -08:00
Eric Wong b9c8518722 git-svn: remove support for the svn command-line client
Using the command-line client was great for prototyping and
getting something working quickly.  Eventually I found time
to study the library documentation and add support for using
the libraries which are much faster and more flexible when
it comes to supporting new features.

Note that we require version 1.1 of the SVN libraries, whereas
we supported the command-line svn client down to version 1.0.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-16 05:17:17 -08:00
Eric Wong aef4e921a0 git-svn: convert to using Git.pm
Thanks to Git.pm, I've been able to greatly reduce the amount
of extra work that needs to be done to manage input/output
pipes in Perl.

chomp usage has also been greatly reduced, too.

All tests (including full-svn-test) still pass, but this has
not been tested extensively in the real-world.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-15 22:39:47 -08:00
Junio C Hamano 62e1aeabc0 git-svn: allow both diff.color and color.diff
The list concensus is to group color related configuration under
"color.*" so let's be consistent.

Inspired by Andy Parkins's patch to do the same for diff/log
family.  With fixes from Eric Wong.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 15:58:41 -08:00
Eric Wong 359850041e git-svn: correctly handle "(no author)" when using an authors file
The low-level parts of the SVN library return NULL/undef for
author-less revisions, whereas "(no author)" is a (svn) client
convention.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-13 12:08:01 -08:00
Eric Wong c53d696bcc git-svn: correctly handle packed-refs in refs/remotes/
We now use git-rev-parse universally to read refs, instead
of our own file_to_s function (which I plan on removing).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 17:26:23 -08:00
Eric Wong 6fda05aebe git-svn: correctly display fatal() error messages
If I wanted to print $@, I'd pass $@ to fatal().  This looks like
a stupid typo on my part.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 17:07:05 -08:00
Eric Wong dd31da2fdc git-svn: allow dcommit to take an alternate head
Previously dcommit would unconditionally commit all patches
up-to and including the current HEAD.  Now if an optional
command-line argument is specified, it will only commit
up to the specified revision.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 17:07:05 -08:00
Eric Wong d2a9a87b8a git-svn: enable logging of information not supported by git
The changes are now tracked in
  $GIT_DIR/svn/$GIT_SVN_ID/untracked.log

Information in the untracked.log include:
  * the addition and removal of empty directories
    (changes of these will also warn the user)
  * file and directory property changes, including (but not
    limited to) svk:merge and svn:externals
  * revision properties (revprops) are also tracked
  * users will be warned of 'absent' file and directories
    (if users are forbidden access)

Fields in entries are separated by spaces; "unsafe" characters
are URI-encoded so that each entry takes exactly one line.

There is currently no automated parser for dealing with the data
in untracked.log, but it should be possible to write one to
create empty directories on checkout and manage
externals/subprojects.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12 17:07:04 -08:00
Eric Wong a552db3a64 git-svn: use do_switch for --follow-parent if the SVN library supports it
do_switch works with the SVN Perl bindings after r22312 in the
Subversion trunk.  Since no released version of SVN currently
supports it; we'll just autodetect it and enable its usage
when a user has a recent-enough version of SVN.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-08 11:31:49 -08:00
Eric Wong 006ede5e86 git-svn: extra error check to ensure we open a file correctly
This may be an issue with repositories imported with commit
27a1a8014b or later, but before
commit dad73c0bb9.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-08 02:07:01 -08:00
Eric Wong ebdf7b9522 git-svn: avoid network timeouts for long-running fetches
Long-running fetches run inside children to avoid memory leaks.
When we refork, the connection in the parent can be idle for a
long time; attempting to reuse it in the next child can result
in timeouts.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-06 11:11:58 -08:00
Junio C Hamano 278fcd7deb Merge branch 'maint'
* maint:
  git-svn: avoid fetching files twice in the same revision
2006-12-02 17:26:58 -08:00
Eric Wong 6173c197c9 git-svn: avoid fetching files twice in the same revision
SVN is not entirely consistent in returning log information and
sometimes returns file information when adding subdirectories,
and sometimes it does not (only returning information about the
directory that was added).  This caused git-svn to occasionally
add a file to the list of files to be fetched twice.  Now we
change the data structure to be hash to avoid repeated fetches.

As of now (in master), this only affects repositories fetched
without deltas enabled (file://, and when manually overriden
with GIT_SVN_DELTA_FETCH=0); so this bug mainly affects users of
1.4.4.1 and maint.

Thanks to Florian Weimer for reporting this bug.

[jc: backported for maint]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-02 17:25:34 -08:00
Eric Wong 1ca7558dd8 git-svn: fix multi-init
After the bugfix to connect to repositories where the user has
limited read permissions, multi-init was broken due to our
SVN::Ra connection being limited to working in a subdirectory;
so we now create a new Ra connection for init-ing branches
and another for tags

Along with that fix, allow the user to use the command-line
option flags for multi-init (--revision being the most notable;
but also --no-auth-cache, --config-dir, --username (for passing
to SVN), and --shared/--template for passing to git-init-db

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-28 20:59:43 -08:00
Eric Wong 9aca025849 git-svn: color support for the log command
* match LESS environment settings to those in pager.c
 * parse diff.color and pager.color settings in the
   config file, and pass --color to git-log
 * --color and --pager= settings are supported

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-28 20:59:35 -08:00
Eric Wong 0864e3ba12 git-svn: fix output reporting from the delta fetcher
There was nothing printed in the code originally because I left
out a pair of parentheses.  Nevertheless, the affected code has
been replaced with a more efficient version that respects the -q
flag as well as requiring less bandwidth.

We save some bandwidth by not requesting changed paths
information when calling get_log() since we're using the delta
fetcher.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-28 14:22:52 -08:00
Eric Wong dad73c0bb9 git-svn: error out when the SVN connection fails during a fetch
finish_report does seem to return a useful value indicating success
or failure, so we'll just set a flag when close_edit is called
(it is not called on failures, nor is abort_edit) and check
the flag before proceeding.

Thanks to Pazu for pointing this out.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-28 14:13:43 -08:00
Eric Wong 27a1a8014b git-svn: enable delta transfers during fetches when using SVN:: libs
This should drastically reduce bandwidth used for network
transfers.  This is not enabled for file:// repositories by
default because of the increased CPU usage and I/O needed.

GIT_SVN_DELTA_FETCH may be set to a true value to enable or
false (0) to disable delta transfers regardless of the
repository type.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-27 22:22:57 -08:00
Eric Wong 6f23ebf600 git-svn: use ~/.subversion config files when using SVN:: libraries
This allows users to use HTTP proxy information (among other settings)
from ~/.subversion/servers and ~/.subversion/config

--config-dir (as before) may be passed to git-svn to override the
default choice of '~/.subversion' for the configuration directory.

Thanks to tko on #git for pointing this out.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-27 13:55:49 -08:00
Eric Wong efe4631def git-svn: allow SVN:: lib users to track the root of the repository (again)
I broke this again in 747fa12cef.

Thanks to merlyn for pointing this out to me on IRC.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-25 19:59:32 -08:00
Eric Wong d25c26e771 git-svn: exit with status 1 for test failures
Some versions of the SVN libraries cause die() to exit with 255,
and 40cf043389 tightened up
test_expect_failure to reject return values >128.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 23:17:00 -08:00
Eric Wong 747fa12cef git-svn: correctly access repos when only given partial read permissions
Sometimes users are given only read access to a subtree inside a
repository, and git-svn could not read log information (and thus
fetch commits) when connecting a session to the root of the
repository.  We now start an SVN::Ra session with the full URL
of what we're tracking, and not the repository root as before.

This change was made much easier with a cleanup of
repo_path_split() usage as well as improving the accounting of
authentication batons.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 23:16:58 -08:00
Eric Wong 30d055aa1e git-svn: handle authentication without relying on cached tokens on disk
This is mostly gleaned off SVN::Mirror, with added support for
--no-auth-cache and --config-dir.

Even with this patch, git-svn does not yet support repositories
where the user only has partial read permissions.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 02:23:22 -08:00
Eric Wong 4769489a41 git-svn: preserve uncommitted changes after dcommit
Using dcommit could cause the user to lose uncommitted changes
during the reset --hard operation, so change it to reset --mixed.

If dcommit chooses the rebase path, then git-rebase will already
error out when local changes are made.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-23 15:17:46 -08:00
Eric Wong e70dc780a4 git-svn: correctly handle revision 0 in SVN repositories
some SVN repositories have a revision 0 (committed by no author
and no date) when created; so when we need to ensure that we
check any revision variables are defined, and not just
non-zero.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-23 15:17:45 -08:00
Eric Wong 48d044b5fe git-svn: error out from dcommit on a parent-less commit
dcommit would unconditionally append "~1" to a commit in order
to generate a diff.  Now we generate a meaningful error message
if we try to generate an impossible diff.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-23 15:17:43 -08:00
Eric Wong 45bf473a7b git-svn: fix dcommit losing changes when out-of-date from svn
There was a bug in dcommit (and commit-diff) which caused deltas
to be generated against the latest version of the changed file
in a repository, and not the revision we are diffing (the tree)
against locally.

This bug can cause recent changes to the svn repository to be
silently clobbered by git-svn if our repository is out-of-date.

Thanks to Steven Grimm for noticing the bug.

The (few) people using the commit-diff command are now required
to use the -r/--revision argument.  dcommit usage is unchanged.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-09 09:34:46 -08:00
Eric Wong a35a045874 git-svn: don't die on rebuild when --upgrade is specified
--copy-remote and --upgrade are rarely (never?) used together,
so if --copy-remote is specified, that means the user really
wanted to copy the remote ref, and we should fail if that fails.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-09 09:34:36 -08:00
Eric Wong 75bd7e374e git-svn: avoid printing filenames of files we're not tracking
This is purely an aesthetic change, we already skip importing of
files that don't affect the subdirectory we import.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-09 09:34:27 -08:00
Eric Wong 9ffd652a38 git-svn: fix symlink-to-file changes when using command-line svn 1.4.0
I incorrectly thought this was hopelessly broken in svn 1.4.0,
but now it's just broken in that the old method didn't work.  It
looks like svn propdel and svn propset must be used now and the
(imho) more obvious svn rm --force && svn add no longer works.

"make -C t full-svn-test" should now work.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Acked-by: Uwe Zeisberger <zeisberg@informatik.uni-freiburg.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-24 15:15:51 -07:00
Eric Wong f7197dff15 git-svn: reduce memory usage for large commits
apply_textdelta and send_stream can use a separate pool from the
rest of the editor interface, so we'll use a separate SVN::Pool
for them and clear the pool after each file is sent to SVN.

This drastically reduces memory usage per-changeset committed,
and makes large commits (and initial imports) of several
thousand files possible.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-14 17:38:52 -07:00
Eric Wong ce91fc6eb9 git-svn: fix commits over svn+ssh://
Once a get_commit_editor has been called from an SVN session, RA
layer operations are not allowed (well, unless you're using
file:// or http(s)://).  So we'll pass an alternate SVN::Ra
object to our editor object for running 'check-path'.

This should fix commits over svnserve (svn:// without ssh, too).

Closes Debian bug #392702, thanks to Pierre Habouzit for
reporting the bug.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-14 11:48:33 -07:00
Eric Wong 83e9940a5e git-svn: add a message encouraging use of SVN::* libraries
I'm using svn 1.4.0-4 in Debian unstable and apparently there's
a regression on the SVN side that prevents a symlink from
becoming a regular file (which git supports, of course).

It's not a noticeable regression for most people, but this broke
the full-svn-tests target in t/Makefile for me.

The SVN::* Perl libraries seem to have matured and improved over
the past year, and git-svn has supported them for several months
now, so with that I encourage all users to start using the
SVN::* Perl libraries with git-svn.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-11 20:19:49 -07:00
Eric Wong b203b769f2 git-svn: -h(elp) message formatting fixes
'graft-branches' is slightly longer than the rest of the
commands, so the text was squished together in the formatted
output.  This patch just adds some more whitespace to make
the text look more pleasant.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-11 15:24:18 -07:00
Eric Wong 74a31a100a git-svn: log command fixes
Change the --verbose flag to more closely match svn.  I was
somehow under the impression that --summary included --raw diff
output, but I was wrong.  We now pass -r --raw --name-status as
arguments if passed -v/--verbose.

-r (recursive) is passed by default, since users usually want
it, and accepting it causes difficulty with the -r<revision>
option used by svn users.  A --non-recursive switch has been
added to disable this.

Of course, --summary, --raw, -p and any other git-log options
can still be passed directly (without --name-status).

Also, several warnings about referencing undefined variables
have been fixed.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-11 14:41:13 -07:00
Eric Wong c35b96e785 git-svn: multi-init saves and reuses --tags and --branches arguments
This should make it much easier to track newly added tags and
branches.  Re-running multi-init without command-line arguments
should now detect new-tags and branches.

--trunk shouldn't change often, but running multi-init on it
is now idempotent.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-11 14:41:11 -07:00
Sergey Vlasov 191414c025 git-svn: Fix fetch --no-ignore-externals with GIT_SVN_NO_LIB=1
When using Subversion 1.3.1 without Perl bindings (GIT_SVN_NO_LIB=1),
"git-svn fetch --no-ignore-externals" fails with errors like:

  Tree (.../.git/svn/git-svn/tree) is not clean:
  X      directory_with_external

In this case the 'X' lines in the "svn status" output are not a sign
of unclean tree, and therefore should be ignored.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-26 23:43:12 -07:00
Shawn Pearce 8815788e93 Allow '(no author)' in git-svn's authors file.
When trying to import an SVN revision which has no author the Git
user may desire to relabel '(no author)' to another name and email
address with their svn.authorsfile.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 20:19:28 -07:00
Shawn Pearce f7bae37f9a Allow 'svn fetch' on '(no date)' revisions in Subversion.
Added --ignore-nodate to allow 'git svn fetch' to import revisions
from Subversion which have '(no date)' listed as the date of the
revision.  By default 'git svn fetch' will crash with an error
when encountering such a revision.  The user may restart the fetch
operation by adding --ignore-nodate if they want to continue tracking
that repository.

I'm not entirely sure why a centralized version control system such
as Subversion permits revisions to be created with absolutely no
date/time associated with it but it apparently is possible as one
of the Subversion repositories that I'm tracking with 'git svn'
created such a revision on '(no date)' and by '(no user)'.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 20:19:22 -07:00
Eric Wong 5f641ccc69 git-svn: stop repeatedly reusing the first commit message with dcommit
Excessive use of global variables got me into trouble.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-26 17:54:15 -07:00
Eric Wong b22d449721 git-svn: add the 'dcommit' command
This is a high-level wrapper around the 'commit-diff' command
and used to produce cleaner history against the mirrored repository
through rebase/reset usage.

It's basically a more polished version of this:

for i in `git rev-list --no-merges remotes/git-svn..HEAD | tac`; do
	git-svn commit-diff $i~1 $i
done
git reset --hard remotes/git-svn

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-26 00:59:29 -07:00
Eric Wong 5a990e45f9 git-svn: establish new connections on commit after fork
SVN seems to have a problem with https:// repositories from
time-to-time when doing multiple, sequential commits.  This
problem is not consistently reproducible without the patch,
but it should go away entirely with this patch...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-25 21:26:21 -07:00
Eric Wong a69a165fb4 git-svn: split the path from the url correctly with limited perms
This version of the splitter (that only affects SVN:: library
users) works when one only has limited read-permissions to
the repository they're fetching from.

Updated from the original patch to workaround some SVN bug
somewhere, which only seems to happen against file://
repositories...  Here's the diff against the original patch I
submitted:

@@ -1159,8 +1159,8 @@ sub repo_path_split {
 	}

 	if ($_use_lib) {
-		$SVN = libsvn_connect($full_url);
-		my $url = $SVN->get_repos_root;
+		my $tmp = libsvn_connect($full_url);
+		my $url = $tmp->get_repos_root;
 		$full_url =~ s#^\Q$url\E/*##;
 		push @repo_path_split_cache, qr/^(\Q$url\E)/;
 		return ($url, $full_url);

Somehow connecting to a repository with the full url makes the
returned SVN::Ra object act strangely and break things, so now
we just drop the SVN::Ra object that we made our initial
connection with.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-11 23:55:21 -07:00
Eric Wong 308906fa6e git-svn: bugfix: allow SVN:: lib users to track the root of the repository
I'm not sure if anybody has hit this (besides me), but this
fixes the problem where I ran into while attempting to import a
small repo at the root level:  I ended up with all the commits, but
with no file/tree changes at all throughout the entire history.

Also, fix a warning if the commit message is not defined for revision 0.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-11 16:21:51 -07:00
Eric Wong 17a10f3709 git-svn: correctly kill keyword expansion without munging EOLs
This bugfix applies to users of the svn command-line client only.

We no longer muck with newlines when killing keyword expansion.
This tended to generate unintended diffs in commits because svn
revert -R would destroy the manual EOL changes we were doing. Of
course, we didn't need the EOL munging in the first place, as
svn seems to do it for us even in the text-base files.

Now we set the mtime and atime the files changed by keyword
expansion killing to avoid triggering a change on svn revert,
which svn still seems to want to do.

Thanks to Seth Falcon for reporting this bug.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-11 16:16:40 -07:00
Eric Wong d0d8f7dc5f git-svn: fix fetching new directories copies when using SVN:: libs
Log output from SVN doesn't list all the new files that were
added if a new directory was copied from an existing place in
the repository.  This means we'll have to do some extra work and
traverse new directories ourselves.

This has been updated from the original patch to defer traversed
adds until all removals have been done.  Please disregard the
original.

Thanks to Ben Williamson for the excellent bug report and
testing.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-23 23:35:24 -07:00
Eric Wong 7b520e62a2 git-svn: don't check for migrations/upgrades on commit-diff
Unlike other git-svn commands, commit-diff is intended to
operate without needing any additional metadata inside .git

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-16 13:46:47 -07:00
Pavel Roskin 82e5a82fd7 Fix more typos, primarily in the code
The only visible change is that git-blame doesn't understand
"--compability" anymore, but it does accept "--compatibility" instead,
which is already documented.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-10 00:36:44 -07:00
Eric Wong 4ad4515dfe git-svn: fix --file/-F option in commit-diff
Also, allow messages from tags to be used as
commit messages.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-10 00:19:34 -07:00
Eric Wong 60d02ccc18 git-svn: migrate out of contrib
Allow NO_SVN_TESTS to be defined to skip git-svn tests.  These
tests are time-consuming due to SVN being slow, and even more so
if SVN Perl libraries are not available.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-06 17:02:47 -07:00
Renamed from contrib/git-svn/git-svn.perl (Browse further)