Commit Graph

91 Commits

Author SHA1 Message Date
Aaron Crane
0455ec0330 cvsimport: new -R option: generate .git/cvs-revisions mapping
This option causes the creation or updating of a file mapping CVS
(filename, revision number) pairs to Git commit IDs.  This is expected
to be useful if you have CVS revision numbers stored in commit messages,
bug-tracking systems, email archives, and the like.

Signed-off-by: Aaron Crane <git@aaroncrane.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-06 11:01:59 -08:00
Ben Walton
91fe7324c5 cvsimport: standarize system() calls to external git tools
This patch standardizes calls to system() where external git tools are
called.  Instead of system("git foo ... "), use system(qw(git foo ...)).
All calls are made without the use of an 'sh -c' process to split the
arguments.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-19 12:22:19 -08:00
Ben Walton
a12477dbe1 cvsimport: standarize open() calls to external git tools
Standardize calls to open() where external git tools are used as
part of a pipeline.  Instead of open(X, "git foo ... |)", use
open(X, "-|", qw(git foo ...)).  All calls are made without the
use of an 'sh -c' process to split the arguments.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-19 12:21:34 -08:00
Ben Walton
640d9d0873 cvsimport: modernize callouts to git subcommands
This patch updates all calling conventions for external git tools.  to
use the modern calling convention (eg: git foo instead of git-foo).
This is almost entierly a s/git-/git / operation, with deviations only
as required to keep tests passing.

Reported-by: Alexander Maier <amaier@opencsw.org>
Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-19 12:16:07 -08:00
Jeff King
f6fdbb6804 cvsimport: fix relative argument filenames
One of the first things that cvsimport does is chdir to the
newly created git repo. This means that any filenames given
to us on the command line will be looked up relative to the
git repo directory. This is probably not what the user
expects, so let's remember and prepend the original
directory for relative filenames.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-19 00:31:02 -07:00
Clemens Buchacher
e481b1d8db cvs: initialize empty password
If we do not read a password from the command line, and there are no
passwords stored in .cvspass, we have to initialize the password with
just "A".

This fixes a regression introduced by 3fb9d582 (Do not scramble
password read from .cvspass).

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-17 00:38:49 -07:00
Pascal Obry
3fb9d58235 Do not scramble password read from .cvspass
Passwords stored in .cvspass are already scrambled, we do not
want to scramble them twice. Only passwords read from the
command line are scrambled.

This fixes a regression introduced by b2139db (git-cvsimport: add support
for cvs pserver password scrambling., 2009-08-14).

Signed-off-by: Pascal Obry <pascal@obry.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-05 22:34:27 -07:00
Dirk Hoerner
b2139dbd72 git-cvsimport: add support for cvs pserver password scrambling.
Instead of a cleartext password, the CVS pserver expects a scrambled one
in the authentication request. With this patch it is possible to import
CVS repositories only accessible via pserver and user/password.

Signed-off-by: Dirk Hoerner <dirker@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-14 19:49:35 -07:00
Junio C Hamano
04bb50f45d Merge branch 'maint'
* maint:
  RelNotes 1.5.6.5 updates
  diff.renamelimit is a basic diff configuration
  git-cvsimport.perl: Print "UNKNOWN LINE..." on stderr, not stdout.
  Documentation: typos / spelling fixes in older RelNotes
2008-08-05 21:21:08 -07:00
Jim Meyering
3be3999849 git-cvsimport.perl: Print "UNKNOWN LINE..." on stderr, not stdout.
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-05 11:40:28 -07:00
Stephan Beyer
1b1dd23f2d Make usage strings dash-less
When you misuse a git command, you are shown the usage string.
But this is currently shown in the dashed form.  So if you just
copy what you see, it will not work, when the dashed form
is no longer supported.

This patch makes git commands show the dash-less version.

For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh
generates a dash-less usage string now.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13 14:12:48 -07:00
Philippe Bruhat (BooK)
8c372fb01d git-cvsimport: do not fail when CVSROOT is /
For CVS repositories with unusual CVSROOT, git-cvsimport would fail:

    $ git-cvsimport -v -C foo -d :pserver:anon:@cvs.example.com:/ foo
    AuthReply: error 0 : no such repository

This patch ensures that the path is never empty, but at least '/'.

Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-10 22:24:01 -07:00
Paul Oliver
509792b94f Make git-cvsimport remove ['s from tags, as bad_ref_char doesn't allow them.
Signed-off-by: Paul Oliver <puzza007@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-25 13:06:49 -07:00
Junio C Hamano
30c0312fd1 Merge branch 'maint-1.5.4' into maint
* maint-1.5.4:
  cvsimport: always pass user data to "system" as a list
  fix reflog approxidate parsing bug
2008-04-29 22:55:07 -07:00
Jeff King
b3bb5f76e6 cvsimport: always pass user data to "system" as a list
This avoids invoking the shell. Not only is it faster, but
it prevents the possibility of interpreting our arguments in
the shell.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-29 22:45:27 -07:00
Junio C Hamano
b75aaa546e Merge branch 'maint'
* maint:
  git-cvsimport: fix merging with remote parent branch
  gitweb: Fix bug in href(..., -replay=>1) when using 'pathinfo' form
2008-03-12 23:47:31 -07:00
Marc-Andre Lureau
c36c5b845e git-cvsimport: fix merging with remote parent branch
commit-tree fails when specifying a remote name (via -r option) and
one of the parent branch has a name. Prefixing with "$remote/" fix it.

Signed-off-by: Marc-Andre Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-12 21:03:39 -07:00
Philippe Bruhat (BooK
bc434e829c cvsimport: allow for multiple -M options
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-01 00:55:38 -08:00
Philippe Bruhat (BooK
fbbbc362ab cvsimport: have default merge regex allow for dashes in the branch name
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-03-01 00:55:38 -08:00
Gerrit Pape
9386ecbb1c cvsimport: have default merge regex also match beginning of commit message
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-02-13 14:22:54 -08:00
Dan McGee
cfc44a12fe cvsimport: remove last use of repo-config from git standard tools
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>
2008-01-13 21:48:22 -08:00
Jeff King
3a969ef1d6 cvsimport: die on cvsps errors
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-23 22:33:07 -08:00
Stefan Sperling
77190eb9b8 Small comment fix for git-cvsimport.
Signed-off-by: Stefan Sperling <stsp@stsp.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-22 00:23:17 -08:00
Junio C Hamano
65c6a4696a Merge branch 'maint'
* 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-30 16:21:33 -08:00
Jeff King
67d232426b cvsimport: fix usage of cvsimport.module
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-30 15:00:31 -08:00
Jeff King
0750d75115 cvsimport: miscellaneous packed-ref fixes
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-28 14:38:35 -08:00
Jeff King
9da0dabcd9 cvsimport: use rev-parse to support packed refs
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-28 14:38:06 -08:00
Gordon Hopper
2e458e0575 git-cvsimport: fix handling of user name when it is not set in CVSROOT
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-09 01:23:40 -08:00
Gerrit Pape
a0554224a2 git-cvsimport: really convert underscores in branch names to dots with -u
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-11-03 21:31:22 -07:00
Michael Smith
ee834cf0c7 (cvs|svn)import: Ask git-tag to overwrite old tags.
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-09-07 21:02:39 -07:00
Gerrit Pape
7051c3b129 git-cvsimport: force checkout of working tree after initial import
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-28 21:16:53 -07:00
Dave O'Neill
47ee8ed292 Generate tags with correct timestamp (git-svnimport)
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-22 22:13:49 -07:00
Junio C Hamano
9bfe9f80b1 Merge branch 'aw/cvs'
* 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-12 21:04:52 -07:00
Junio C Hamano
03545396ef Merge branch 'ep/cvstag'
* ep/cvstag:
  Use git-tag in git-cvsimport
2007-06-12 21:01:27 -07:00
Junio C Hamano
a6080a0a44 War on whitespace
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-07 00:04:01 -07:00
Elvis Pranskevichus
5c08931dfc Use git-tag in git-cvsimport
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-06 16:14:28 -07:00
Michael Milligan
23fcdc7971 git-cvsimport: Make sure to use $git_dir always instead of .git sometimes
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-06 15:23:35 -07:00
Andy Whitcroft
06baffd3df cvsimport: add <remote>/HEAD reference in separate remotes more
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-06 02:35:49 -07:00
Andy Whitcroft
cbc9be5ca3 cvsimport: update documentation to include separate remotes option
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-06 02:35:49 -07:00
Andy Whitcroft
8b7f5fc1ca cvsimport: add support for new style remote layout
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-06-06 02:35:49 -07:00
Stephan Springl
7ca055f75a Use git-for-each-ref to check whether the origin branch exists.
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-05-23 11:06:38 -07:00
Frank Lichtenheld
7bf77644e7 cvsimport: Improve usage error reporting
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-06 16:46:11 -07:00
Frank Lichtenheld
edbe446674 cvsimport: sync usage lines with existing options
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-04-06 16:45:58 -07:00
James Bowes
ed35dece27 Read cvsimport options from repo-config
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-02-07 23:54:25 -08:00
Junio C Hamano
bf3f67ba71 cvsimport: activate -a option, really.
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-22 12:20:14 -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
Martin Langhoff
4083c2fce8 cvsimport: cleanup temporary cvsps file
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-08 03:01:35 -08:00
Martin Langhoff
ded9f40059 cvsimport: skip commits that are too recent (option and documentation)
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-08 03:01:16 -08:00
Martin Langhoff
6211988f77 cvsimport: skip commits that are too recent
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>
2007-01-07 18:06:49 -08:00
Junio C Hamano
86d11cf264 cvsimport: style fixup.
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-27 14:21:30 -08:00