Commit Graph

128 Commits

Author SHA1 Message Date
Rocco Rutte
f1397c068b hg-fast-export.py: Fix option presence checking
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-19 09:05:51 +00:00
Rocco Rutte
8aff9df2c3 hg-reset.sh: Helper for partially re-importing from hg
Given a hg revision to reset to, these scripts get the latest changes
per hg branch and print git SHA1. The user then needs to manually reset
branches as needed, tune the state file and can re-import things again.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-19 09:04:42 +00:00
Rocco Rutte
7044bdd4d1 Add hg2git.py with library routines
Unfortunately, I can't do 'import hg-fast-export' from python itself, so
we need to move some common methods into 'hg2git.py' which is to be used
as a library for common hg->git routines.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-19 08:45:42 +00:00
Rocco Rutte
b0492474e3 Ignore *.pyc files
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-19 08:38:27 +00:00
Rocco Rutte
b57ad30740 Replace some references from hg2git to hg-fast-import
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-16 18:19:08 +00:00
Simon Hausmann
84ca2f71c8 Default to interactive syncing 2007-03-16 13:47:46 +01:00
Simon Hausmann
c24e9e1bf3 Be more strict with Perforce after synching. 2007-03-15 19:07:06 +01:00
Simon Hausmann
6b1cb84f56 Auto-detect the current branch 2007-03-14 23:30:23 +01:00
Simon Hausmann
39fa67264e Ignore weird apple files :) 2007-03-14 19:03:16 +01:00
Simon Hausmann
2b756cf156 Be nice and use /usr/bin/env python for the git-p4 scripts 2007-03-14 17:33:46 +01:00
Simon Hausmann
235047bd9b Automatically operate on a temporary branch, needed for cherry-pick to work when applying changes to
files that are deleted in the future.
Also do some Perforce cleaning
2007-03-14 17:31:47 +01:00
Rocco Rutte
1c311b6ef6 Use svn_repos_open() for svn-archive.c, too
Without the change, running it does nothing at all here.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-14 15:56:57 +00:00
Rocco Rutte
bca24a3468 Obtain svn_fs_t via svn_repos_open() -> svn_repos_fs()
Without really knowing the svn API, using plain svn_fs_open() complained
about a missing /foo/DB_CONFIG even on fsfs type repos. Use
svn_repos_open() to open the repo and use svn_repos_fs() to get the fs
instead of using svn_fs_open() since even the headers say I wouldn't
want to use it directly... and they're right, obviously. :)

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-14 15:35:33 +00:00
Rocco Rutte
e25b88e15f Allow CFLAGS and LDFLAGS to be overwritten on command line
Hardcoding doesn't make sense, after all.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-14 15:19:13 +00:00
Rocco Rutte
3919be7d55 hg-fast-export.sh Use hg-fast-export.py, not dead hg2git.py
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-14 10:56:18 +00:00
Rocco Rutte
30ce6693ed hg-fast-export.py: Kill stale usage() and __doc__
Both are obsolete since using the option parser.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-14 10:32:33 +00:00
Rocco Rutte
c84790da82 Use MIT license, adjust hg2git script names to match fast-export repo style
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-14 10:29:24 +00:00
Rocco Rutte
3e0fb1cf11 Merge branch 'master' of git://repo.or.cz/hg2git
* 'master' of git://repo.or.cz/hg2git: (38 commits)
  hg2git.py: Only print verification message for branches we have
  hg2git.py: Add simple delta revision feed
  hg2git.py: Create only leightweight tags
  hg2git.py: add -f/--force option to bypass validation checks
  hg2git.py: Bail out for certain errors
  Add a note about hg's unnamed branches and multiple heads
  hg2git.py: For the first revision, feed out full manifest
  hg2git.py: Don't complain die for non-existent heads
  Remove SHA stability note from readme
  hg2git.py: Remove leading/trailing spaces from authormap
  hg2git.py: Allow for spaces in authorfile
  hg2git.sh: Add usage note that argument order matters
  hg2git.sh: Complete --help output's option listing
  Basic support for an author map
  hg2git.py: Fix typo saving status to headsfile instead of statusfile
  hg2git.py: Display our max revision as progress, not tip
  hg2git.py: Disable parsing Signef-off-by lines and add -s to enable
  Basic support for command line options in hg2git.py
  Rename README.txt to hg2git.txt
  Only attempt to verify heads hg has, too
  ...
2007-03-14 10:22:52 +00:00
Rocco Rutte
f9879136a9 hg2git.py: Only print verification message for branches we have
It's pointless for many branches to print the validation message for the
first revision already; the same counts for incremental runs.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-14 10:13:27 +00:00
Rocco Rutte
287365c160 hg2git.py: Add simple delta revision feed
Now we have three methods of feeding out changes
  1) full for first revision or
  2) thorough delta for merges (compare checksums with all parents) or
  3) simple delta else (only got with manifest)

This requires some cleanup so that we have only place where we actually
call the appropriate dumping method.

The export_file_contents() method now also sorts its file list before
writing out anything as this seems to speed up hg data retrival a bit.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-14 10:02:15 +00:00
Rocco Rutte
af2237607c hg2git.py: Create only leightweight tags
The annotated tag with commit message summary was primarily only for
debugging.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-14 08:34:18 +00:00
Rocco Rutte
d988112549 hg2git.py: add -f/--force option to bypass validation checks
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-13 16:43:20 +00:00
Rocco Rutte
ad283a91ca hg2git.py: Bail out for certain errors
New is that we also check for multiple tips having the same branch name,
i.e. no unnamed heads.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-13 16:31:57 +00:00
Simon Hausmann
80a53a93c8 Lots of fixes done together with Paul 2007-03-13 16:36:10 +01:00
Rocco Rutte
d9bb3271a4 Add a note about hg's unnamed branches and multiple heads
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-13 15:27:29 +00:00
Rocco Rutte
5732cd0313 hg2git.py: For the first revision, feed out full manifest
For the mutt and hg repos, it didn't make a difference, but attempting
to run the conversion on the opensolaris repo looks like this is needed.

When we attempt to export some commit, special-case the revision number
0 and export all files the manifest has while labeling this a "full
revision export". Otherwise we do what we did before labeling this a
"delta revision export".

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-13 10:59:22 +00:00
Simon Hausmann
2c5ef2f811 Fix git-dir option and allow reading log substitutions from a file 2007-03-13 09:14:45 +01:00
Simon Hausmann
16dc558805 First shot at a script that allows applying changesets back from git to perforce 2007-03-12 23:00:34 +01:00
Rocco Rutte
191928202b hg2git.py: Don't complain die for non-existent heads
Previously, when no head was present under .git/refs/heads, we simply
died as we couldn't open the file. Now, simply return None in case we
cannot read from it.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-12 11:13:48 +00:00
Rocco Rutte
e448736a0b Remove SHA stability note from readme
Turns out, it isn't true though the diffs are still empty, i.e.

  $ git log --name-status --no-merges b1..b2

produces bogus output when b1 is the a branch from the main hg repo and
b2 a fork of it. But

  $ git diff b1..b2

still produces the correct result.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-12 11:05:33 +00:00
Rocco Rutte
cedbd0fb86 hg2git.py: Remove leading/trailing spaces from authormap
The current regex may leave us with keys/values having trailing/leading
spaces in all flavours which will break lookup. Solution: strip() key
and value.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-12 10:45:32 +00:00
Rocco Rutte
59a481a2b0 hg2git.py: Allow for spaces in authorfile
By allowing spaces in keys we allow for (re-)mapping complete lines
like "Joe User <joe@host>" to be mapped to something else.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-12 10:26:46 +00:00
Rocco Rutte
75dc075d52 hg2git.sh: Add usage note that argument order matters
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-12 10:25:01 +00:00
Rocco Rutte
7f9098823c hg2git.sh: Complete --help output's option listing
This also adds some more verbose descriptions than the bare listing.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-12 09:06:48 +00:00
Rocco Rutte
230a320c84 Basic support for an author map
As git-(cvs|svn)import support it, make futrue git-hgimport :) support it, too.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-12 08:54:30 +00:00
Rocco Rutte
20b4ca920b hg2git.py: Fix typo saving status to headsfile instead of statusfile
This broke incremental imports as hg2git.sh wrapper overwrites headsfile
with current values after the import is done.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-12 08:13:40 +00:00
Rocco Rutte
80f028a16c hg2git.py: Display our max revision as progress, not tip
Displaying tip doesn't make sense when we have some max given with -m/--max.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-12 08:12:08 +00:00
Rocco Rutte
469d4f3305 hg2git.py: Disable parsing Signef-off-by lines and add -s to enable
IMHO it's highly unusual to have these lines in hg projects but who
knows. As it's slow to parse these types of lines (with regex), it's
disabled by default and the 'author' command of git-fast-import isn't
used at all.

It can be enabled by giving the -s switch to hg2git.sh.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-12 08:00:18 +00:00
Rocco Rutte
045eea436c Basic support for command line options in hg2git.py
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-12 07:33:40 +00:00
Simon Hausmann
e15f1d8964 Make the caching official, sort of :) 2007-03-10 21:30:24 +01:00
Simon Hausmann
8be48137ae less false integrations 2007-03-10 21:23:49 +01:00
Simon Hausmann
c78fd1b668 More work on merge detection 2007-03-10 17:46:49 +01:00
Rocco Rutte
2030a3a736 Rename README.txt to hg2git.txt
This is to avoid naming clashes since I'm more or less about to merge
hg2git into fast-export.git at repo.or.cz.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-10 14:29:49 +00:00
Rocco Rutte
af3810ae2f Only attempt to verify heads hg has, too
In the git repo there may be any number branches that are not hg
imported branches, so it doesn't make sense to print warnings when a
non-hg head isn't at what it was last time.

Now we get a list of branchtags hg has and only verify these.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-10 14:28:45 +00:00
Simon Hausmann
1dcff16b12 Cleanups and preparations for true branch merge detection 2007-03-10 11:46:26 +01:00
Simon Hausmann
cd02317d67 Cleanups 2007-03-10 10:53:07 +01:00
Simon Hausmann
1e602ee4d9 make the debug cache configurable 2007-03-10 10:25:34 +01:00
Simon Hausmann
852fcfea75 Haha, of course the extension should be .py! 2007-03-10 09:49:19 +01:00
Rocco Rutte
796fa5f4cb hg2git.py: Add support for extracting authorship from Signed-off-by lines
Unfortunately, it's not configurable yet (read: cannot be disabled) as
it may take some time to match against regex all the time (especially
from some initial import).

This also enables cleaning up usernames by stripping silly leading and
trailing chars like '"' (which is the only one supported ATM).

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-09 12:07:08 +00:00
Rocco Rutte
3198560016 hg2git.py: Add support for user-defined hg author -> git author mapping
The mapping is a python dictionary given to the hg2git() function. This
isn't extremely useful as there's no option passing from hg2git.sh to
hg2git.py (yet).

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-03-09 11:09:57 +00:00