1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-02 07:17:58 +01:00
Commit graph

1404 commits

Author SHA1 Message Date
Eric Wong
c0d4822268 git-svn: bugfix and optimize the 'log' command
Revisions with long commit messages were being skipped, since
the 'git-svn-id' metadata line was at the end and git-log uses a
32k buffer to print the commits.

Also the last 'git-svn-id' metadata line in a commit is always
the valid one, so make sure we use that, as well.

Made the verbose flag work by passing the correct option switch
('--summary') to git-log.

Finally, optimize -r/--revision argument handling by passing
the appropriate limits to revision

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:21 -07:00
Eric Wong
968bdf1f3d git-svn: Eliminate temp file usage in libsvn_get_file()
This means we'll have a loose object when we encounter a symlink
but that's not the common case.

We also don't have to worry about svn:eol-style when using the
SVN libraries, either.  So remove the code to deal with that.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:21 -07:00
Eric Wong
cf7424b021 git-svn: fix several small bugs, enable branch optimization
Share the repack counter between branches when doing
multi-fetch.

Pass the -d flag to git repack by default.  That's the
main reason we will want automatic pack generation, to
save space and improve disk cache performance.  I won't
add -a by default since it can generate extremely large
packs that make RAM-starved systems unhappy.

We no longer generate the .git/svn/$GIT_SVN_ID/info/uuid
file, either.  It was never read in the first place.

Check for and create .rev_db if we need to during fetch (in case
somebody manually blew away their .rev_db and wanted to start
over.  Mainly makes debugging easier).

Croak with $? instead of $! if there's an error closing pipes

Quiet down some of the chatter, too.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:20 -07:00
Eric Wong
6c5cda89e9 git-svn: avoid creating some small files
repo_path_split() is already pretty fast, and is already
optimized via caching.

We also don't need to create an exclude file if we're
relying on the SVN libraries.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:20 -07:00
Eric Wong
42d328701d git-svn: make the $GIT_DIR/svn/*/revs directory obsolete
This is a very intrusive change, so I've beefed up the tests
significantly.  Added 'full-test' a target to the Makefile,
to test different possible configurations.  This is intended
for maintainers only.  Users should only be concerned with
'test' succeeding.

We now have a very simple custom database format for handling
mapping of svn revisions => git commits.  Of course, we're
not really using it yet, either.

Also disabled automatic branch-finding on new trees for now.
It's too easily broken.  revisions_eq() function should be
helpful for branch detection.

Also removed an extra assertion in fetch_cmd() that wasn't
correctly done.  This bug was found by full-test.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:20 -07:00
Eric Wong
a5e0cedc0a git-svn: add support for Perl SVN::* libraries
This means we no longer have to deal with having bloated SVN
working copies around and we get a nice performance increase as
well because we don't have to exec the SVN binary and start a
new server connection each time.

Of course we have to manually manage memory with SVN::Pool
whenever we can, and hack around cases where SVN just eats
memory despite pools (I blame Perl, too).  I would like to
keep memory usage as stable as possible during long fetch/commit
processes since I still use computers with only 256-512M RAM.

commit should always be faster with the SVN library code.  The
SVN::Delta interface is leaky (or I'm not using it with pools
correctly), so I'm forking on every commit, but that doesn't
seem to hurt performance too much (at least on normal Unix/Linux
systems where fork() is pretty cheap).

fetch should be faster in most common cases, but probably not all.
fetches will be faster where client/server delta generation is
the bottleneck and not bandwidth.  Of course, full-files are
generated server-side via deltas, too.  Full files are always
transferred when they're updated, just like git-svnimport and
unlike command-line svn.  I'm also hacking around memory leaks
(see comments) here by using some more forks.

I've tested fetch with http://, https://, file://, and svn://
repositories, so we should be reasonably covered in terms of
error handling for fetching.

Of course, we'll keep plain command-line svn compatibility as a
fallback for people running SVN 1.1 (I'm looking into library
support for 1.1.x SVN, too).  If you want to force command-line
SVN usage, set GIT_SVN_NO_LIB=1 in your environment.

We also require two simultaneous connections (just like
git-svnimport), but this shouldn't be a problem for most
servers.

Less important commands:

show-ignore is slower because it requires repository
access, but -r/--revision <num> can be specified.

graft-branches may use more memory, but it's a
short-term process and is funky-filename-safe.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:20 -07:00
Eric Wong
79bb8d88fc git-svn: add 'log' command, a facsimile of basic `svn log'
This quick feature should make it easy to look up svn log
messages when svn users refer to -r/--revision numbers.

The following features from `svn log' are supported:

  --revision=<n>[:<n>] - is supported, non-numeric args are not:
			 HEAD, NEXT, BASE, PREV, etc ...
  -v/--verbose         - just maps to --raw (in git log), so
			 it's completely incompatible with
			 the --verbose output in svn log
  --limit=<n>          - is NOT the same as --max-count,
			 doesn't count merged/excluded commits
  --incremental        - supported (trivial :P)

New features:

  --show-commit        - shows the git commit sha1, as well
  --oneline            - our version of --pretty=oneline

Any other arguments are passed directly to `git log'

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:20 -07:00
Eric Wong
7a97de4e19 git-svn: add UTF-8 message test
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:20 -07:00
Eric Wong
9d55b41aad git-svn: add some functionality to better support branches in svn
New commands:

graft-branches - The most interesting command of the bunch.  It
detects branches in SVN via various techniques (currently
regexes and file copies).   It can be later extended to handle
svk and other properties people may use to track merges in svk.
Basically, merge tracking is not standardized at all in the SVN
world, and git grafts are perfect for dealing with this
situation.

Existing branch support (via tree matches) is only handled at
fetch time.

The following tow were originally implemented as shell scripts
several months ago, but I just decided to streamline things a
bit and added them to the main script.

multi-init - supports git-svnimport-like command-line syntax for
importing repositories that are layed out as recommended by the
SVN folks.  This is a bit more tolerant than the git-svnimport
command-line syntax and doesn't require the user to figure out
where the repository URL ends and where the repository path
begins.

multi-fetch - runs fetch on all known SVN branches we're
tracking.  This will NOT discover new branches (unlike
git-svnimport), so multi-init will need to be re-run (it's
idempotent).

Consider these three to be auxilliary commands (like
show-ignore, and rebuild) so their behavior won't receive as
much testing or scrutiny as the core commands (fetch and
commit).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:20 -07:00
Eric Wong
f8ab6b732f git-svn: add --shared and --template= options to pass to init-db
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:20 -07:00
Eric Wong
dc5869c00d git-svn: add --repack and --repack-flags= options
This should help keep disk usage sane for large imports.

--repack takes an optional argument for the interval, it
defaults to 1000 if no argument is specified.

Arguments to --repack-flags are passed directly to git-repack.
No arguments are passed by default.

Idea stolen from git-cvsimport :)

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:20 -07:00
Eric Wong
b8c92cadda git-svn: minor cleanups, extra error-checking
While we're at it, read_repo_config has been added and
expanded to handle case where command-line arguments are
optional to Getopt::Long

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:20 -07:00
Eric Wong
883d0a78d2 git-svn: Move all git-svn-related paths into $GIT_DIR/svn
Since GIT_SVN_ID usage is probably going to become more
widespread <evil grin>, we won't run the chance of somebody
having a GIT_SVN_ID name that conflicts with one of the default
directories that already exist in $GIT_DIR (branches/tags).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:20 -07:00
Eric Wong
6dfbe5163e git-svn: support manually placed initial trees from fetch
Sometimes I don't feel like downloading an entire tree again when
I actually decide a branch is worth tracking, so some users can
get around it more easily with this.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:20 -07:00
Eric Wong
098749d9be git-svn: optimize --branch and --branch-all-ref
By breaking the pipe read once we've seen a commit twice.

This should make -B/--branch-all-ref faster and usable on a
frequent basis.

We use topological order now for calling git-rev-list, and any
commit we've seen before should imply that all parents have been
seen (at least I hope that's the case for --topo-order).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:20 -07:00
Eric Wong
bf78b1d89b git-svn: --branch-all-refs / -B support
This should make life easier for all those who type:

	`git-rev-parse --symbolic --all | xargs -n1 echo -b`

every time they run git-svn fetch.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:20 -07:00
Eric Wong
162f412921 git-svn: support -C<num> passing to git-diff-tree
The repo-config key is 'svn.copysimilarity'

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:19 -07:00
Eric Wong
b63af9b340 git-svn: don't allow commit if svn tree is not current
If new revisions are fetched, that implies we haven't merged,
acked, or nacked them yet, and attempting to write the tree
we're committing means we'd silently clobber the newly fetched
changes.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:19 -07:00
Eric Wong
ce475dfcb5 git-svn: restore original LC_ALL setting (or unset) for commit
svn forces UTF-8 for commit messages, and with LC_ALL set to 'C'
it is unable to determine encoding of the git commit message.

Now we'll just assume the user has set LC_* correctly for
the commit message they're using.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:19 -07:00
Eric Wong
4a393f2b53 git-svn: eol_cp corner-case fixes
If we read the maximum size of our buffer into $buf, and the
last character is '\015', there's a chance that the character is
'\012', which means our regex won't work correctly.  At the
worst case, this could introduce an extra newline into the code.
We'll now read an extra character if we see '\015' is the last
character in $buf.

We also forgot to recalculate the length of $buf after doing the
newline substitution, causing some files to appeare truncated.
We'll do that now and force byte semantics in length() for good
measure.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:19 -07:00
Eric Wong
8a97e36888 git-svn: fix handling of filenames with embedded '@'
svn has trouble parsing files with embedded '@' characters.  For
example,

  svn propget svn:keywords foo@bar.c
  svn: Syntax error parsing revision 'bar.c'

I asked about this on #svn and the workaround suggested was to append
an explicit revision specifier:

  svn propget svn:keywords foo@bar.c@BASE

This patch appends '@BASE' to the filename in all calls to 'svn
propget'.

Patch originally by Seth Falcon <sethfalcon@gmail.com>
Seth: signoff?

[ew: Made to work with older svn that don't support peg revisions]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:19 -07:00
Eric Wong
c7162c1db6 git-svn: t0000: add -f flag to checkout
Some changes to the latest git.git made this test croak.  So
we'll always just force everything when using a new branch.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-06-16 03:04:19 -07:00
Aneesh Kumar K.V
4e2e5647f2 gitview: Add some useful keybindings.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-04 13:29:36 -07:00
Eric Wong
037b048ece git-svn: remove assertion that broke with older versions of svn
svn < 1.3.x would display changes to keywords lines as modified
if they aren't expanded in the working copy.  We already check
for changes against the git tree here, so checking against the
svn one is probably excessive.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-29 23:14:50 -07:00
Eric Wong
3c4c7351c0 git-svn: t0001: workaround a heredoc bug in old versions of dash
The dash installed on my Debian Sarge boxes don't seem to like
<<'' as a heredoc starter.  Recent versions of dash do not need
this fix.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-29 23:14:49 -07:00
Aneesh Kumar K.V
756944350d gitview: Move the console error messages to message dialog
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-28 10:53:08 -07:00
Aneesh Kumar K.V
034016391c gitview: Add key binding for F5.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-28 10:52:38 -07:00
Eric Wong
36f5b1f0c8 git-svn: ignore expansion of svn:keywords
Unlike my earlier test patch, this also checks svn:eol-style and
makes sure it's applied to working copy updates.  This is
definitely more correct than my original attempt at killing
keyword expansions, but I still haven't tested it enough to
know.  Feedback would be much appreciated.

Also changed assert_svn_wc_clean() to only work on the svn
working copy.  This requires a separate call to assert_tree() to
check wc integrity against git in preparation for another change
I'm planning.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 21:37:30 -07:00
Eric Wong
304dac1548 git-svn: starting a 1.1.0-pre development version
Some not-very-well-tested changes coming...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 21:37:23 -07:00
Junio C Hamano
288c038450 Merge branch 'js/fetchconfig'
* js/fetchconfig:
  Add a conversion tool to migrate remote information into the config
  fetch, pull: ask config for remote information
2006-05-19 17:44:07 -07:00
Eric Wong
88521450fc git-svn 1.0.0
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-05 14:19:11 -07:00
Eric Wong
81c5a0e6e5 git-svn: documentation updates
* Clarify that 'init' requires an argument
* Remove instances of 'SVN_URL' in the manpage, it's not an
  environment variable.
* Refer to 'Additional Fetch Arguments' when documenting 'fetch'
* document --authors-file / -A option

Thanks to Pavel Roskin and Seth Falcon for bringing these issues
to my attention.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-05 14:18:41 -07:00
Johannes Schindelin
a4a6e4ab32 Add a conversion tool to migrate remote information into the config
Use this tool to rewrite the .git/remotes/* files into the config.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-04 00:07:06 -07:00
Junio C Hamano
96afa0764e Add colordiff for git to contrib/colordiff.
I hacked it up to teach it the git extended diff headers, made
it not to read the whole patch in the array.

Also, the original program, when arguments are given, ran "diff"
with the given arguments and showed the output from it.  Of
course, I changed it to run "git diff" ;-).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-21 22:24:30 -07:00
Eric Wong
fc9957b005 contrib/git-svn: handle array values correctly
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-04 00:09:47 -07:00
Eric Wong
5f2f424002 contrib/git-svn: make sure our git-svn is up-to-date for test
Bugs like the last one could've been avoided if it weren't for
this...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-04 00:09:45 -07:00
Eric Wong
5941a9e9d8 contrib/git-svn: ensure repo-config returns a value before using it
fetching from repos without an authors-file defined was broken.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-04 00:09:42 -07:00
Eric Wong
20b1d700c9 contrib/git-svn: documentation updates
contrib/git-svn/git-svn.txt:
	added git-repo-config key names for options
	fixed quoting of "git-svn-HEAD" in the manpage
	use preformatted text for examples

contrib/git-svn/Makefile:
	add target to generate HTML:
		http://git-svn.yhbt.net/git-svn.html

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-01 21:57:55 -08:00
Eric Wong
53909056da contrib/git-svn: accept configuration via repo-config
repo-config keys are any of the long option names minus the '-'
characters

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-01 21:57:52 -08:00
Eric Wong
13ccd6d4f2 contrib/git-svn: force GIT_DIR to an absolute path
We chdir internally, so we need a consistent GIT_DIR variable.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-30 15:40:38 -08:00
Eric Wong
0382318424 contrib/git-svn: stabilize memory usage for big fetches
We should be safely able to import histories with thousands
of revisions without hogging up lots of memory.

With this, we lose the ability to autocorrect mistakes when
people specify revisions in reverse, but it's probably no longer
a problem since we only have one method of log parsing nowadays.

I've added an extra check to ensure that revision numbers do
increment.

Also, increment the version number to 0.11.0.  I really should
just call it 1.0 soon...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-25 21:23:54 -08:00
Eric Wong
ac74905064 contrib/git-svn: allow rebuild to work on non-linear remote heads
Because committing back to an SVN repository from different
machines can result in different lineages, two different
repositories running git-svn can result in different commit
SHA1s (but of the same tree).  Sometimes trees that are tracked
independently are merged together (usually via children),
resulting in non-unique git-svn-id: lines in rev-list.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-20 23:31:19 -08:00
Alexandre Julliard
2b1c0ef2e5 git.el: Added a function to diff against the other heads in a merge.
git-diff-file-merge-head generates a diff against the first merge
head, or with a prefix argument against the nth head. Bound to `d h'
by default.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-19 12:30:14 -08:00
Alexandre Julliard
75a8180d4b git.el: Get the default user name and email from the repository config.
If user name or email are not set explicitly, get them from the
user.name and user.email configuration values before falling back to
the Emacs defaults.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-19 12:30:07 -08:00
Alexandre Julliard
9de83169d3 git.el: More robust handling of subprocess errors when returning strings.
Make sure that functions that call a git process and return a string
always return nil when the subprocess failed.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-19 12:30:01 -08:00
Eric Wong
779b144625 contrib/git-svn: fix a harmless warning on rebuild (with old repos)
It's only for repositories that were imported with very early
versions of git-svn.  Unfortunately, some of those repos are out
in the wild already, so fix this warning.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-09 10:10:30 -08:00
Eric Wong
7317ed906a contrib/git-svn: remove the --no-stop-on-copy flag
Output a big warning if somebody actually has a pre-1.0 version
of svn that doesn't support it.

Thanks to Yann Dirson for reminding me it still existed
and attempting to re-enable it :)

I think I subconciously removed support for it earlier...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-09 10:10:18 -08:00
Eric Wong
1d52aba839 contrib/git-svn: fix svn compat and fetch args
'svn info' doesn't work with URLs in svn <= 1.1.  Now we
only run svn info in local directories.

As a side effect, this should also work better for 'init' off
directories that are no longer in the latest revision of the
repository.

svn checkout -r<revision> arguments are fixed.
Newer versions of svn (1.2.x) seem to need URL@REV as well as
-rREV to checkout a particular revision...

Add an example in the manpage of how to track directory that has
been moved since its initial revision.

A huge thanks to Yann Dirson for the bug reporting and testing
my original patch.  Thanks also to Junio C Hamano for suggesting
a safer way to use git-rev-parse.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-09 10:04:58 -08:00
Mark Wooding
8911db70f8 contrib/emacs/Makefile: Provide tool for byte-compiling files.
Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-05 11:32:49 -08:00
Alexandre Julliard
a79656e6af git.el: Added customize support for all parameters.
Also fixed quoting of git-log-msg-separator.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-04 13:47:02 -08:00
Alexandre Julliard
45033ad9e3 git.el: Added support for Signed-off-by.
If `git-append-signed-off-by' is non-nil, automatically append a
sign-off line to the log message when editing it.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-04 13:46:52 -08:00
Alexandre Julliard
b23761d9ac git.el: Automatically update .gitignore status.
Update .gitignore files in the status list as they are created or
modified.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-04 13:46:20 -08:00
Alexandre Julliard
a944652c05 git.el: Set default directory before running the status mode setup hooks.
Also set the list-buffers-directory variable for nicer buffer list
display.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-04 13:46:13 -08:00
Alexandre Julliard
18e3e99e3d git.el: Portability fixes for XEmacs and Emacs CVS.
Fixed octal constants for XEmacs.
Added highlighting support in log-edit buffer for Emacs CVS.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-04 13:45:58 -08:00
Alexandre Julliard
486a974acc contrib/emacs: Add an Emacs VC backend.
Add a basic Emacs VC backend. It currently supports the following
commands: checkin, checkout, diff, log, revert, and annotate. There is
only limited support for working with revisions other than HEAD.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-04 13:45:37 -08:00
Eric Wong
ce4c8b24a1 contrib/git-svn: fix a copied-tree bug in an overzealous assertion
I thought passing --stop-on-copy to svn would save us from all
the trouble svn-arch-mirror had with directory (project) copies.
I was wrong, there was one thing I overlooked.

If a tree was moved from /foo/trunk to /bar/foo/trunk with no
other changes in r10, but the last change was done in r5, the
Last Changed Rev (from svn info) in /bar/foo/trunk will still be
r5, even though the copy in the repository didn't exist until
r10.

Now, if we ever detect that the Last Changed Rev isn't what
we're expecting, we'll run svn diff and only croak if there are
differences between them.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-03 15:07:12 -08:00
Eric Wong
448c81b495 contrib/git-svn: better documenting of CLI switches
Also, fix a asciidoc formatting error

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-03 11:27:30 -08:00
Eric Wong
6f0783cf94 contrib/git-svn: add --id/-i=$GIT_SVN_ID command-line switch
I ended up using GIT_SVN_ID far more than I ever thought I
would.  Typing less is good.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-03 11:27:29 -08:00
Eric Wong
1ca72aef45 contrib/git-svn: avoid re-reading the repository uuid, it never changes
If it does change, we're screwed anyways as SVN will refuse to
commit or update.  We also never access more than one SVN
repository per-invocation, so we can store it as a global, too.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-03 11:27:27 -08:00
Eric Wong
7f60b22860 contrib/git-svn: create a more recent master if one does not exist
In a new repository, the initial fetch creates a master branch
if one does not exist so HEAD has something to point to.

It now creates a master at the end of the initial fetch run,
pointing to the latest revision.  Previously it pointed to the
first revision imported, which is generally less useful.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-03 11:27:25 -08:00
Eric Wong
eeb0abe047 contrib/git-svn: cleanup option parsing
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-03 11:27:22 -08:00
Eric Wong
a9612be245 contrib/git-svn: allow --authors-file to be specified
Syntax is compatible with git-svnimport and git-cvsimport:

	normalperson = Eric Wong <normalperson@yhbt.net>

If this option is specified and git-svn encounters an SVN
committer name that it cannot parse, it git-svn will abort.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-03 11:27:20 -08:00
Eric Wong
df746c5a81 contrib/git-svn: strip 'git-svn-id:' when commiting to SVN
We regenerate and use git-svn-id: whenever we fetch or otherwise
commit to remotes/git-svn.  We don't actually know what revision
number we'll commit to SVN at commit time, so this is useless.
It won't throw off things like 'rebuild', though, which knows to
only use the last instance of git-svn-id: in a log message

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-03 11:27:18 -08:00
Eric Wong
ac8e0b910c contrib/git-svn: several small bug fixes and changes
* Fixed manually-edited commit messages not going to
   remotes/git-svn on sequential commits after the sequential
   commit optimization.
 * format help correctly after adding 'show-ignore'
 * sha1_short regexp matches down to 4 hex characters
   (from git-rev-parse --short documentation)
 * Print the first line of the commit message when we commit to
   SVN next to the sha1.
 * Document 'T' (type change) in the comments

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-03 11:27:14 -08:00
Eric Wong
69f0d91e49 contrib/git-svn: add -b/--branch switch for branch detection
I've said I don't like branches in Subversion, and I still don't.
This is a bit more flexible, though, as the argument for -b is any
arbitrary git head/tag reference.

This makes some things easier:
 * Importing git history into a brand new SVN branch.
 * Tracking multiple SVN branches via GIT_SVN_ID, even from multiple
   repositories.
 * Adding tags from SVN (still need to use GIT_SVN_ID, though).
 * Even merge tracking is supported, if and only the heads end up with
   100% equivalent tree objects.  This is more stricter but more robust
   and foolproof than parsing commit messages, imho.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-03 11:27:10 -08:00
Aneesh Kumar K.V
9645da330f gitview: pass the missing argument _show_clicked_cb.
In our last update to use the encoding while showing the commit
diff we added a new argument to this function. But we missed
updating all the callers.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-02 23:07:01 -08:00
Eric Wong
2beb3cdd18 contrib/git-svn: use refs/remotes/git-svn instead of git-svn-HEAD
After reading a lengthy discussion on the list, I've come to the
conclusion that creating a 'remotes' directory in refs isn't
such a bad idea.

You can still branch from it by specifying remotes/git-svn (not
needing the leading 'refs/'), and the documentation has been
updated to reflect that.

The 'git-svn' part of the ref can of course be set to whatever
you want by using the GIT_SVN_ID environment variable, as
before.

I'm using refs/remotes/git-svn, and not going with something
like refs/remotes/git-svn/HEAD as it's redundant for Subversion
where there's zero distinction between branches and directories.

Run git-svn rebuild --upgrade to upgrade your repository to use
the new head.  git-svn-HEAD must be manually deleted for safety
reasons.

Side note: if you ever (and I hope you never) want to run
git-update-refs on a 'remotes/' ref, make sure you have the
'refs/' prefix as you don't want to be clobbering your
'remotes/' in $GIT_DIR (where remote URLs are stored).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-02 00:01:36 -08:00
Aneesh Kumar K.V
5aa44d50f4 gitview: Use horizontal scroll bar in the tree view
Earlier we set up the window to never scroll
horizontally, which made it harder to use on a narrow screen.
This patch allows scrollbar to be used as needed by Gtk

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-01 21:32:00 -08:00
Aneesh Kumar K.V
d82343b938 gitview: Set the default width of graph cell
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-28 11:02:10 -08:00
Aneesh Kumar K.V
0852694ba4 gitview: Some window layout changes.
This makes menubar look nice

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-28 11:02:08 -08:00
Pavel Roskin
3abe217a5b gitview: Select the text color based on whether the entry in highlighted. Use standard font.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-28 11:02:02 -08:00
Eric Wong
7be737680f contrib/git-svn: correct commit example in manpage
Thanks to Nicolas Vilz <niv@iaglans.de> for noticing this.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-27 15:27:51 -08:00
Eric Wong
b705ba43c6 contrib/git-svn: tell the user to not modify git-svn-HEAD directly
As a rule, interface branches to different SCMs should never be modified
directly by the user.  They are used exclusively for talking to the
foreign SCM.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-27 12:55:16 -08:00
Aneesh Kumar K.V
c447f10f99 gitview: Remove trailing white space
Do the cleanup using Dave jones vim script

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-27 11:01:58 -08:00
Aneesh Kumar K.V
68d55b83a5 gitview: Fix the encoding related bug
Get the encoding information from repository and convert it to utf-8 before
passing to gtk.TextBuffer.set_text. gtk.TextBuffer.set_text work only with utf-8

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-27 11:01:54 -08:00
Eric Wong
3c0b7511cd contrib/git-svn: version 0.10.0
New features deserve an increment of the minor version.  This will very
likely become 1.0.0 unless release-critical bugs are found.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-26 15:04:59 -08:00
Eric Wong
e17512f3de contrib/git-svn: optimize sequential commits to svn
Avoid running 'svn up' to a previous revision if we know the
revision we just committed is the first descendant of the
revision we came from.

This reduces the time to do a series of commits by about 25%.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-26 15:02:45 -08:00
Eric Wong
8f22562c6b contrib/git-svn: add show-ignore command
Recursively finds and lists the svn:ignore property on
directories.  The output is suitable for appending to the
$GIT_DIR/info/exclude file.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-26 14:55:13 -08:00
Aneesh Kumar K.V
1509bd9e69 gitview: Fix the graph display .
This fix all the known issue with the graph display
The bug need to be explained graphically

                                 |
                                 a
This line need not be there ---->| \
                                 b  |
                                 | /
                                 c

c is parent of a and all a,b and c are placed on the same line and b is child of c
With my last checkin I added  a seperate line to indicate that a is
connected to c. But then we had the line connecting a and b which should
not be ther. This changes fixes the same bug

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-24 17:27:46 -08:00
Aneesh Kumar K.V
9e4f522da7 gitview: Code cleanup
Rearrange the code little bit so that it is easier to read

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-24 17:27:39 -08:00
Aneesh Kumar
20d23f554d gitview: Bump the rev
Make the 0.7 release

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-24 03:14:44 -08:00
Aneesh Kumar
8b42f5ae54 gitview: Fix DeprecationWarning
DeprecationWarning: integer argument expected, got float

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-24 03:14:34 -08:00
Aneesh Kumar K.V
3fe5489a25 gitview: Display the lines joining commit nodes clearly.
Since i wanted to limit the graph box size i was resetting
the window after an index of 5. This result in line joining
commit nodes to pass over nodes which are not related. The
changes fixes the same

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-23 22:17:42 -08:00
Junio C Hamano
d27d5b3c5b gitview: ls-remote invocation shellquote safety.
This will allow you to point GIT_DIR at directories with funny names.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-22 03:47:20 -08:00
aneesh.kumar@gmail.com
d800795613 gitview: Use monospace font to draw the branch and tag name
This patch address the below:
Use monospace font to draw branch and tag name
set the font size to 13.
Make the graph column resizable. This helps to accommodate large tag names

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-21 18:38:11 -08:00
aneesh.kumar@gmail.com
5301eee92c gitview: Read tag and branch information using git ls-remote
This fix the below bug

Junio C Hamano <junkio@cox.net> writes:

>
> It does not work in my repository, since you do not seem to
> handle branch and tag names with slashes in them.  All of my
> topic branches live in directories with two-letter names
> (e.g. ak/gitview).

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-21 18:38:11 -08:00
Eric Wong
551ce28fe1 git-svn: 0.9.1: add --version and copyright/license (GPL v2+) information
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-20 13:32:42 -08:00
Eric Wong
96a40b27c9 contrib/git-svn: add Makefile, test, and associated ignores
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-20 13:32:42 -08:00
Eric Wong
cf52b8f063 git-svn: fix several corner-case and rare bugs with 'commit'
None of these were really show-stoppers (or even triggered)
on most of the trees I've tracked.

* Node change prevention for identically named nodes.  This is
  a limitation of SVN, but we find the error and exit before
  it's passed to SVN so we don't dirty our working tree when our
  commit fails.  git-svn will exit with an error code 1 if any
  of the following conditions are found:

  1.  a directory is removed and a file of the same name of the
      removed directory is created
  1a. a file has its parent directory removed and the file is
      takes the name of the removed parent directory::
          baz/zzz    =>  baz
  2.  a file is removed and a directory of the same name of the
      removed file is created.
  2a. a file is moved into a deeper directory that shares the
      previous name of the file::
          dir/$file  =>  dir/file/$file

  Since SVN cannot handle these cases, the user will have to
  manually split the commit into several parts.

* --rmdir now handles nested/deep removals. If dir/a/b/c/d/e/file
  is removed, and everything else is in the dir/ hierarchy is
  otherwise empty, then dir/ will be deleted when file is deleted
  from svn and --rmdir specified.

* Always assert that we have written the tree we want to write
  on commits.  This helped me find several bugs in the symlink
  handling code (which as been fixed).

* Several symlink handling fixes.  We now refuse to set
  permissions on symlinks.  We also always unlink a file
  if we're going to overwrite it.

* Apply changes in a pre-determined order, so we always have
  rename from locations handy before we delete them.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-20 13:32:41 -08:00
Eric Wong
bbe0c9b8d8 contrib/git-svn.txt: add a note about renamed/copied directory support
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-20 13:32:41 -08:00
Eric Wong
472ee9e3d6 git-svn: change ; to && in addremove()
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-20 13:32:41 -08:00
Eric Wong
ce6f351903 git-svn: remove any need for the XML::Simple dependency
XML::Simple was originally required back when I made svn-arch-mirror
because I needed to explictly track renames with Arch.  Then I carried
it over to git-svn because I was afraid somebody could commit an svn
log message that could throw off a non-XML log parser.  Then I noticed
the <n> lines column in the header.  So, no more XML :)

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-20 13:32:41 -08:00
Eric Wong
8de010ad28 git-svn: Allow for more argument types for commit (from..to)
Allow 'from..to' notation from the command line.

More liberal sha1 parsing when reading from stdin no longer requires the
sha1 to be the first character, so a leading 'commit ' string is OK.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-20 13:32:41 -08:00
Eric Wong
72942938bf git-svn: allow --find-copies-harder and -l<num> to be passed on commit
Both of these options are passed directly to git-diff-tree when
committing to a SVN repository.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-20 13:32:40 -08:00
Eric Wong
a18b632762 git-svn: fix a typo in defining the --no-stop-on-copy option
Just a typo, I doubt anybody would use (and I highly recommend not
using) this option anyways.  But you never know...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-20 13:32:40 -08:00
Alexandre Julliard
711fc8f660 Add an Emacs interface in contrib.
This is an Emacs interface for git. The user interface is modeled on
pcl-cvs. It has been developed on Emacs 21 and will probably need some
tweaking to work on XEmacs.

The basic command is 'M-x git-status' which displays a buffer listing
modified files in the selected project tree. In that buffer the
following features are supported:

  - add/remove files
  - list unknown files
  - commit marked files
  - manage .gitignore
  - commit merges based on MERGE_HEAD
  - revert files to the HEAD version
  - resolve conflicts with smerge or ediff
  - diff files against HEAD/base/mine/other or combined diff
  - get a log of the revisions for specified files

There are plenty of unimplemented features too, see the TODO list at
the top of the file...

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-18 10:57:15 -08:00
Aneesh Kumar K.V
c4d133a2b8 gitview: typofix
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
2006-02-18 01:22:42 -08:00
Eric Wong
0870321548 git-svn: remove files from the index before adding/updating
This fixes a bug when importing where a directory gets removed/renamed
but is immediately replaced by a file of the same name in the same
revision.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2006-02-18 01:22:39 -08:00
Aneesh Kumar K.V
020e3c1ee6 Add a README for gitview
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-17 13:34:13 -08:00
Junio C Hamano
0c0fab2da4 Add contrib/README.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-17 13:33:14 -08:00
Aneesh Kumar
8cb711c8a5 Add contrib/gitview from Aneesh.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-17 02:10:31 -08:00
Eric Wong
defc649229 git-svn: ensure fetch always works chronologically.
We run svn log against a URL without a working copy for the first fetch,
so we end up a log that's sorted from highest to lowest.  That's bad, we
always want lowest to highest.  Just default to --revision 0:HEAD now if
-r isn't specified for the first fetch.

Also sort the revisions after we get them just in case somebody
accidentally reverses the argument to --revision for whatever reason.

Thanks again to Emmanuel Guerin for helping me find this.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-17 01:01:24 -08:00
Eric Wong
1c6bbbf37b git-svn: fix revision order when XML::Simple is not loaded
Thanks to Emmanuel Guerin for finding the bug.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-17 01:01:20 -08:00
Eric Wong
3397f9df53 Introducing contrib/git-svn. 2006-02-16 01:56:43 -08:00