summaryrefslogtreecommitdiff
path: root/git-cvsimport.perl
AgeCommit message (Collapse)AuthorFilesLines
2008-03-01cvsimport: allow for multiple -M optionsLibravatar Philippe Bruhat (BooK1-5/+10
Use Getopt::Long instead of Getopt::Std to handle multiple -M options, for all the cases when having a single custom regex is not enough. Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01cvsimport: have default merge regex allow for dashes in the branch nameLibravatar Philippe Bruhat (BooK1-1/+1
The default value of @mergerx uses \w, which matches word character; a branch name like policy-20050608-br will not be matched. Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-13cvsimport: have default merge regex also match beginning of commit messageLibravatar Gerrit Pape1-1/+1
The default value of @mergerx uses \W, which matches a non-word character; this means that commit messages like "Merging FOO" are not matched by default; using \b, which matches a word boundary, instead of \W fixes that. This change was suggested by Frédéric Brière through http://bugs.debian.org/463468 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-13cvsimport: remove last use of repo-config from git standard toolsLibravatar Dan McGee1-3/+3
git cvsimport was the last tool to use repo-config instead of config. Update it to use plain git config. Signed-off-by: Dan McGee <dpmcgee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-23cvsimport: die on cvsps errorsLibravatar Jeff King1-0/+1
We were not previously checking the exit status of cvsps at all. If it exited before producing any useful output, we ended up with an empty import, which caused a spew of confusing error messages from other parts of git: $ git-cvsimport foo Initialized empty Git repository in ... some error from cvsps fatal: refs/heads/origin: not a valid SHA1 fatal: master: not a valid SHA1 warning: You appear to be on a branch yet to be born. warning: Forcing checkout of HEAD. fatal: just how do you expect me to merge 0 trees? checkout failed: 256 Now we get: $ git-cvsimport foo Initialized empty Git repository in ... some error from cvsps git-cvsimport: fatal: cvsps reported error Signed-off-by: Jeff King <peff@peff.net> Acked-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-22Small comment fix for git-cvsimport.Libravatar Stefan Sperling1-1/+1
Signed-off-by: Stefan Sperling <stsp@stsp.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-30Merge branch 'maint'Libravatar Junio C Hamano1-30/+23
* maint: Replace the word 'update-cache' by 'update-index' everywhere cvsimport: fix usage of cvsimport.module t7003-filter-branch: Fix test of a failing --msg-filter. cvsimport: miscellaneous packed-ref fixes cvsimport: use rev-parse to support packed refs Add basic cvsimport tests
2007-11-30cvsimport: fix usage of cvsimport.moduleLibravatar Jeff King1-4/+4
There were two problems: 1. We only look at the config variable if there is no module given on the command line. We checked this by comparing @ARGV == 0. However, at the time of the comparison, we have not yet parsed the dashed options, meaning that "git cvsimport" would read the variable but "git cvsimport -a" would not. This is fixed by simply moving the check after the call to getopt. 2. If the config variable did not exist, we were adding an empty string to @ARGV. The rest of the script, rather than barfing for insufficient input, would then try to import the module '', leading to rather confusing error messages. Based on patch from Emanuele Giaquinta. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28cvsimport: miscellaneous packed-ref fixesLibravatar Jeff King1-11/+9
These were found with a grep for '$git_dir'; they all replace a direct access of "$git_dir/refs/..." with a call to git-rev-parse or git-update-ref. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28cvsimport: use rev-parse to support packed refsLibravatar Jeff King1-15/+10
Previously, if refs were packed, git-cvsimport would assume that particular refs did not exist. This could lead to, for example, overwriting previous 'origin' commits that were packed. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-09git-cvsimport: fix handling of user name when it is not set in CVSROOTLibravatar Gordon Hopper1-1/+2
The cvs programs do not default to "anonymous" as the user name, but use the currently logged in user. This patch more closely matches the cvs behavior. Signed-off-by: Gordon Hopper <g.hopper@computer.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-03git-cvsimport: really convert underscores in branch names to dots with -uLibravatar Gerrit Pape1-0/+1
The documentation states for the -u option that underscores in tag and branch names are converted to dots, but this was actually implemented for the tag names only. Kurt Roeckx reported this through http://bugs.debian.org/446495 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-07(cvs|svn)import: Ask git-tag to overwrite old tags.Libravatar Michael Smith1-1/+1
If the tag was moved in CVS or SVN history, it will be moved in the imported history as well. Tag history is not tracked. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-28git-cvsimport: force checkout of working tree after initial importLibravatar Gerrit Pape1-1/+1
When creating a brand new git repository through git-cvsimport (not incremental import), force a checkout of HEAD of master as working tree after successful import using the -f switch to git checkout. Otherwise the working tree is empty, and all files are reported as 'deleted' by git status. This was noticed and reported by Cameron Dale through http://bugs.debian.org/430903 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-22Generate tags with correct timestamp (git-svnimport)Libravatar Dave O'Neill1-1/+0
Now uses git-tag instead of manually constructing the tag. This gives us a correct timestamp, removes some crufty code, and makes it work the same as git-cvsimport. The generated tags are now lightweight tags instead of tag objects, which may or may not be the behaviour we want. Also, remove two unused variables from git-cvsimport. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-12Merge branch 'aw/cvs'Libravatar Junio C Hamano1-15/+25
* aw/cvs: cvsimport: add <remote>/HEAD reference in separate remotes more cvsimport: update documentation to include separate remotes option cvsimport: add support for new style remote layout
2007-06-12Merge branch 'ep/cvstag'Libravatar Junio C Hamano1-23/+1
* ep/cvstag: Use git-tag in git-cvsimport
2007-06-07War on whitespaceLibravatar Junio C Hamano1-6/+6
This uses "git-apply --whitespace=strip" to fix whitespace errors that have crept in to our source files over time. There are a few files that need to have trailing whitespaces (most notably, test vectors). The results still passes the test, and build result in Documentation/ area is unchanged. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06Use git-tag in git-cvsimportLibravatar Elvis Pranskevichus1-24/+2
Currently git-cvsimport tries to create tag objects directly via git-mktag in a very broken way, e.g the stuff it writes into the tagger field of the tag object doesn't really resemble the GIT_COMMITTER_IDENT. This makes gitweb and possibly other tools that try to interpret tag objects to be confused about tag date and authorship. Fix this by calling git-tag instead. This also has a nice side effect of not creating the tag object but only the lightweight tag as that's the only thing CVS has anyways. Signed-off-by: Elvis Pranskevichus <el@prans.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06git-cvsimport: Make sure to use $git_dir always instead of .git sometimesLibravatar Michael Milligan1-3/+3
CVS import was failing on a couple repos I was trying to import. I was setting GIT_DIR=newproj.git and using the -i flag, but this bug was thwarting the effort... evil CVS. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06cvsimport: add <remote>/HEAD reference in separate remotes moreLibravatar Andy Whitcroft1-0/+2
When in separate remote mode (via -r <remote>) we can now use the name HEAD for the CVS HEAD. In keeping with git-clone remotes/<remote>/HEAD is creates as a symbolic ref to the user specified name for the HEAD which defaults to master. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06cvsimport: update documentation to include separate remotes optionLibravatar Andy Whitcroft1-1/+1
Document the cvsimport -r <remote> option which switches cvsimport to using a separate remote for tracking branches. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06cvsimport: add support for new style remote layoutLibravatar Andy Whitcroft1-14/+22
cvsimport creates any branches found in the remote CVS repository in the refs/heads namespace. This makes sense for a repository conversion. When using git as a sane interface to a remote CVS repository, that repository may well remain as the 'master' respository. In this model it makes sense to import the CVS repository into the refs/remotes namespace. Add a new option '-r <remote>' to set the remote name for this import. When this option is specified branches are named refs/remotes/<remote>/branch, with HEAD named as master matching git-clone separate remotes layout. Without branches are placed ion refs/heads, with HEAD named origin as before. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-05-23Use git-for-each-ref to check whether the origin branch exists.Libravatar Stephan Springl1-5/+5
This works in repositories that have their refs packed by "git-pack-refs --all --prune" whereas testing the file $git_dir/refs/heads/$opt_o does not. Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-06cvsimport: Improve usage error reportingLibravatar Frank Lichtenheld1-4/+6
Actually tell the user what he did wrong in case of usage errors instead of only printing the general usage information. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-06cvsimport: sync usage lines with existing optionsLibravatar Frank Lichtenheld1-2/+3
Sync both the usage lines in the code and the asciidoc documentation with the real list of options. While all options seems to be documented in the asciidoc document, not all of them were listed in the usage line. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-07Read cvsimport options from repo-configLibravatar James Bowes1-1/+29
Default values for command line options can be saved in .git/config (or the global ~/.gitconfig). Config option names match the command line option names, so cvsimport.d corresponds to git-cvsimport -d. One may also set cvsimport.module to specify a default cvs module name. Signed-off-by: James Bowes <jbowes@dangerouslyinc.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-22cvsimport: activate -a option, really.Libravatar Junio C Hamano1-1/+1
An earlier commit ded9f400 added $opt_a support to disable the cvsps grace period mechanism, but forgot to tell the option parser about it. Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-12use 'init' instead of 'init-db' for shipped docs and toolsLibravatar Nicolas Pitre1-2/+2
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-08cvsimport: cleanup temporary cvsps fileLibravatar Martin Langhoff1-5/+11
It is bad manners to leave these sizable files around when we are done with them. Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08cvsimport: skip commits that are too recent (option and documentation)Libravatar Martin Langhoff1-3/+5
This makes the earlier "wait for 10 minutes before importing" safety overridable with "-a(ll)" flag, and adds necessary documentation. Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07cvsimport: skip commits that are too recentLibravatar Martin Langhoff1-0/+14
With this patch, cvsimport will skip commits made in the last 10 minutes. The recent-ness test is of 5 minutes + cvsps fuzz window (5 minutes default). When working with a CVS repository that is in use, importing commits that are too recent can lead to partially incorrect trees. This is mainly due to - Commits that are within the cvsps fuzz window may later be found to have affected more files. - When performing incremental imports, clock drift between the systems may lead to skipped commits. This commit helps keep incremental imports of in-use CVS repositories sane. Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-27cvsimport: style fixup.Libravatar Junio C Hamano1-84/+84
This should not change any functionality, but just makes it readable by having a space between syntactic construct keyword and open parenthesis (e.g. "if (expr", not "if(expr") and between close parenthesis and open brace (e.g. "if (expr) {" not "if (expr){"). Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24git-cvsimport: add support for CVS pserver method HTTP/1.x proxyingLibravatar Iñaki Arenaza1-5/+49
This patch adds support for 'proxy' and 'proxyport' connection options when using the pserver method for the CVS Root. It has been tested with a Squid 2.5.x proxy server. Quoting from the CVS info manual: The `gserver' and `pserver' connection methods all accept optional method options, specified as part of the METHOD string, like so: :METHOD[;OPTION=ARG...]: Currently, the only two valid connection options are `proxy', which takes a hostname as an argument, and `proxyport', which takes a port number as an argument. These options can be used to connect via an HTTP tunnel style web proxy. For example, to connect pserver via a web proxy at www.myproxy.net and port 8000, you would use a method of: :pserver;proxy=www.myproxy.net;proxyport=8000: *NOTE: The rest of the connection string is required to connect to the server as noted in the upcoming sections on password authentication, gserver and kserver. The example above would only modify the METHOD portion of the repository name.* PROXY must be supplied to connect to a CVS server via a proxy server, but PROXYPORT will default to port 8080 if not supplied. PROXYPORT may also be set via the CVS_PROXY_PORT environment variable. Signed-off-by: Iñaki Arenaza <iarenuno@eteo.mondragon.edu> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-15Run "git repack -a -d" once more at end, if there's 1MB or more of ↵Libravatar Jim Meyering1-0/+10
not-packed data. Although I converted upstream coreutils to git last month, I just reconverted coreutils once again, as a test, and ended up with a git repository of about 130MB (contrast with my packed git repo of size 52MB). That was because there were a lot of commits (but < 1024) after the final automatic "git-repack -a -d". Running a final git-repack -a -d && git-prune-packed cut the final repository size down to the expected size. So this looks like an easy way to improve git-cvsimport. Just run "git repack ..." at the end if there's more than some reasonable amount of not-packed data. My choice of 1MB is a little arbitrarily. I wouldn't mind missing the minimal repo size by 1MB. At the other end of the spectrum, it's probably not worthwhile to pack everything when the total repository size is less than 1MB. Here's the patch: Signed-off-by: Jim Meyering <jim@meyering.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-20cvsimport: move over to using git-for-each-ref to read refs.Libravatar Andy Whitcroft1-15/+10
cvsimport opens all of the files in $GIT_DIR/refs/heads and reads out the sha1's in order to work out what time the last commit on that branch was made (in CVS) thus allowing incremental updates. However, this takes no account of hierachical refs naming producing the following error for each directory in $GIT_DIR/refs: Use of uninitialized value in chomp at /usr/bin/git-cvsimport line 503. Use of uninitialized value in concatenation (.) or string at /usr/bin/git-cvsimport line 505. usage: git-cat-file [-t|-s|-e|-p|<type>] <sha1> Take advantage of the new packed refs work to use the new for-each-ref iterator to get this information. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28cvsimport - cleanup of the multi-indexes handlingLibravatar Martin Langhoff1-38/+24
Indexes are only needed when we are about preparing to commit. Prime them inside commit() when we have all the info we need, and remove all the redundant index setups. While we are at it, make sure that index handling is correct when opening new branches, and on initial import. Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-24cvsimport: always set $ENV{GIT_INDEX_FILE} to $index{$branch}Libravatar Johannes Schindelin1-7/+8
Also, make sure that the initial git-read-tree is performed. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
2006-06-24cvsimport: setup indexes correctly for ancestors and incremental importsLibravatar Martin Langhoff1-17/+22
Two bugs had slipped in the "keep one index per branch during import" patch. Both incremental imports and new branches would see an empty tree for their initial commit. Now we cover all the relevant cases, checking whether we actually need to setup the index before preparing the actual commit, and doing it. Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-16cvsimport: keep one index per branch during importLibravatar Martin Langhoff1-7/+30
With this patch we have a speedup and much lower IO when importing trees with many branches. Instead of forcing index re-population for each branch switch, we keep many index files around, one per branch. Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-16cvsimport: complete the cvsps run before starting the importLibravatar Martin Langhoff1-14/+28
We now capture the output of cvsps to a tempfile, and then read it in. cvsps 2.1 works quite a bit "in memory", and only prints its patchset info once it has finished talking with cvs, but apparently retaining all that memory allocation. With this patch, cvsps is finished and reaped before cvsimport start working (and growing). So the footprint of the whole process is much lower. Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-16cvsimport: ignore CVSPS_NO_BRANCH and impossible branchesLibravatar Martin Langhoff1-1/+16
cvsps output often contains references to CVSPS_NO_BRANCH, commits that it could not trace to a branch. Ignore that branch. Additionally, cvsps will sometimes draw circular relationships between branches -- where two branches are recorded as opening from the other. In those cases, and where the ancestor branch hasn't been seen, ignore it. Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-25cvsimport: avoid "use" with :tagLibravatar Jeff King1-1/+1
Avoid "use POSIX qw(strftime dup2 :errno_h)"; it was reported that a Perl installations on Mandrake 9.1 did not like it, even though it understood "use POSIX qw(:errno_h)". Funny. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23cvsimport: set up commit environment in perl instead of using envLibravatar Jeff King1-7/+6
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23cvsimport: do not barf on creation of an empty file.Libravatar Junio C Hamano1-1/+1
When the server says "created this file whose length is empty", we mistakenly said "oops, the server did not say a sensible thing". Fix it. Spotted and fixed by Linus, acked by Martin. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23cvsimport: introduce _fetchfile() method and used a 1M buffer to read()Libravatar Martin Langhoff1-17/+19
File retrieval from the socket is now moved to _fetchfile() and we now cap reads at 1MB. This should limit the memory growth of the cvsimport process. Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23cvsimport: cleanup commit functionLibravatar Jeff King1-86/+64
This change attempts to clean up the commit function to make it a bit easier to read (or at least the first half of it). It also improves robustness and performance. Specifically: - report get_headref errors on opening ref unless the error is ENOENT - use regex to check for sha1 instead of length - use lexically scoped filehandles which get cleaned up automagically - check for error on both 'print' and 'close' (since output is buffered) - avoid "fork, do some perl, then exec" in commit(). It's not necessary, and we probably end up COW'ing parts of the perl process. Plus the code is much smaller because we can use open2() - avoid calling strftime over and over (mainly a readability cleanup) Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23cvsimport: use git-update-index --index-infoLibravatar Jeff King1-23/+13
This should reduce the number of git-update-index forks required per commit. We now do adds/removes in one call, and we are no longer forced to deal with argv limitations. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23cvsimport: repack every kilo-commits.Libravatar Linus Torvalds1-1/+5
Signed-off-by: Linus Torvalds <torvalds@osdl.org> Acked-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23cvsimport: introduce -L<imit> option to workaround memory leaksLibravatar Martin Langhoff1-2/+6
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>