Commit Graph

491 Commits

Author SHA1 Message Date
Kyle J. McKay
8ed62c9cf7 hg-fast-export.sh: Do not ignore hg-fast-export.py exit code
Originally 9643aa5d did this by using a bashism even though the
/bin/sh interpreter is being used.

Then ea55929e attempted to compensate for this by disabling the
bashism when the interpreter was not actually bash which results
in the hg-fast-export.py exit code still being ignored in that case.

Instead check the error code without requiring a bashism.
2014-03-16 16:00:42 +01:00
Kyle J. McKay
8b6c6e5cff Revert "Don't ignore hg-fast-export.py exit code"
This reverts commit 9643aa5df2.
2014-03-16 16:00:42 +01:00
Kyle J. McKay
cb55f74437 Revert "Make bashism conditional on the shell being bash"
This reverts commit aaccfba9a0.
2014-03-16 16:00:42 +01:00
Eric Ritchey
7b4729ddc8 checking for - and converting - backslashes 2014-03-13 14:32:10 -07:00
frej
f2491e83b0 Merge pull request #22 from TracyWebTech/master
Not using branchtags
2014-02-14 17:14:12 +01:00
Sergio Oliveira
a4b23c6713 Fixing for hg 2.9 2014-02-10 08:32:27 -02:00
Frej Drejhammar
ddae888d31 Fix typo+grammo in README 2014-01-08 20:29:55 +01:00
Frej Drejhammar
aaccfba9a0 Make bashism conditional on the shell being bash
This avoids breakage due to 9643aa5d on shells other than bash.
2013-09-15 12:29:09 +02:00
Frej Drejhammar
b85743f67e Give a proper error message when the hg repo is not known
hg-fast-export.sh always passes the --repo flag to hg-fast-export.py.
If, for some reason, we have a state file where the repo-url is an
empty string the checks in hg-fast-export.py will not work and the
user will be confused. Therefore we check that the url is specified
before calling hg-fast-export.py.
2013-09-08 14:32:08 +02:00
frej
e1a0b56023 Merge pull request #16 from zr40/patch-1
Don't ignore hg-fast-export.py exit code
2013-09-04 02:11:03 -07:00
Matthijs van der Vleuten
9643aa5df2 Don't ignore hg-fast-export.py exit code 2013-09-04 09:43:17 +02:00
Fantomas42
3ff69b5392 Fix mapping option, close #10 2013-06-21 18:35:38 +02:00
Frej Drejhammar
9a414ca8e2 Update README with pointer to the github issue tracker 2012-10-13 16:27:06 +02:00
Frej Drejhammar
c178d5c8a0 Rename hg-fast-export.txt to README 2012-10-13 16:18:15 +02:00
frej
ad72c608dc Merge pull request #7 from living180/master
Make Windows support actually work
2012-09-30 12:09:08 -07:00
Daniel Harding
7eaba68bc2 Make hg-fast-export (actually) work on Windows
Because on Windows sys.stdout is initially in text mode, any LF
characters written to it will be transformed to CRLF, which causes git
to blow up.  This change uses Windows platform-specific code to change
sys.stdout to binary mode.
2012-09-30 11:10:48 +01:00
frej
e63f780004 Merge pull request #6 from aried3r/master
Fix for Mercurial 2.3 compatibility
2012-08-10 09:10:44 -07:00
Anton Rieder
0dcbd3d195 Organized imports
After an update to Mercurial 2.3 the module 'repo' was removed and the
program crashed when trying to convert a repository. I checked the
imports with 'pyflakes' and removed all unused ones, repo (among
others) was never used.

http://www.selenic.com/repo/hg/rev/1ac628cd7113#l9.1
2012-08-07 01:35:09 +02:00
frej
11224c6c0b Merge pull request #5 from living180/master
Make hg-fast-export work on Windows
2012-06-01 08:05:31 -07:00
Daniel Harding
4ce8835d11 Make hg-fast-export work on Windows
* use sys.stdout.write instead of print to avoid end-of-line issues
* use os.devnull instead of hard-coding /dev/null
2012-05-28 18:57:30 +01:00
frej
d311f7fbc7 Merge pull request #4 from aried3r/master
Fixed a bug related to sanitizing branch names.
2012-05-20 10:31:40 -07:00
Anton Rieder
8f6adfd07c Applied rule #7 of git-check-ref-format
Rule #7 of git-check-ref-format states "7. They cannot end with a dot
'.'." which was not yet implemented in fast-export. This commit fixes
this.
2012-05-16 23:44:00 +02:00
Frej Drejhammar
b2f6d28722 Update documentation: The tool is no longer called hg-fast-import 2012-01-27 20:06:07 +01:00
Frej Drejhammar
a8b1481a8e Mention the author map file in the readme 2012-01-27 20:02:54 +01:00
David Wragg
32c481a98f Add usage info for the --force option 2012-01-23 16:17:44 +00:00
Barry Wardell
e24fa42b87 Commits with no parent need a reset command.
This fixes a problem where a repository is imported incorrectly when there is a merge
between two branches with no common history.
2011-12-09 19:29:14 +01:00
Barry Wardell
0a9570c676 Support the case where the author field has an empty email address, i.e. it is of the form 'name <>'. 2011-11-26 15:07:43 +01:00
Paul O’Shannessy
3e00d99d39 Use hg methods to extract name and email when doing user fixup 2011-10-18 16:20:54 -07:00
David Wragg
fab6d6f025 hg-fast-export.sh should fail if git-fast-import fails
Previously, git-fast-import could fail, and exit with a non-zero status.
But the exit status of hg-fast-export.sh would not reflect this.
2011-06-13 13:05:47 +01:00
David Wragg
b51166f006 Support passing --force to git-fast-import 2011-06-13 12:34:13 +01:00
Frej Drejhammar
486690e176 Remove \" from the user string before trying to extract name and email
Signed-off-by: Frej Drejhammar <frej.drejhammar@gmail.com>
Reported-by: Cole Robinson <crobinso@redhat.com>

Thank's to Cole Robinson for reporting the bug and providing a fix
which was adapted to this patch.

The original bug report:

I was recently converting a few mercurial repositories to git, and
noticed certain commits had their date reset to Jan 1 1970.

An example repo:

http://hg.fedorahosted.org/hg/virt-manager

An example commit:

http://hg.fedorahosted.org/hg/virt-manager/rev/41182500ddef

After some poking, it seems the culprit was that the "author:" was
surrounded by quotation marks
2011-03-18 19:12:45 +01:00
David Wragg
c8a4584896 The "verifying branch" message is not very interesting
Particularly if the repo has hundreds of branches.
2010-09-29 02:02:32 +01:00
David Wragg
2b197f947f Simplify handling of parents of exported commit
The previous code did an awful lot of work to infer the parents of an
exported commit, incorporating information from many sources.  But
there were multiple bugs in this scheme, sometimes resulting in merge
commits with two parents pointing to the same commit object.

Instead, use a much more straightforward process of mapping the
parents stored in hg.
2010-09-29 02:02:22 +01:00
Rocco Rutte
1464dabbff Maintain backwards compatibility for ui setup
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2009-05-25 15:17:33 +02:00
Rocco Rutte
ff19982cc2 Update to work with mercurial ui refactorings
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2009-05-14 14:53:42 +02:00
Matthias Urlichs
0306977b28 hg-fast-export: Compare HG revisions when merging
hg-fast-export uses hg's branch order (from the log) when merging,
this is a problem. Consider the case:

HG repo A  has revisions 1-10. Repository B is cloned from that.
Subsequently, A adds revision 11, and B adds a different change which
also has revision 11. If B now pulls from A, A's rev11 will have the
number 12; if A then pulls from B, the reverse also holds. So the logs
are different even though they contain the exact same changes.

hg-fast-export will thus create different git repositories for A and B,
even though the contents are identical for all practical purposes.
In particular, the repos would be identical if A and B had used git from
the beginning.

To fix that, compare HG revisions instead of log positions.
2009-02-23 18:38:26 +01:00
Rocco Rutte
688623f17e hg-fast-export: Support branches without parents
Previously we fed the full revision only for the first one and deltas
for all following including branches being forked off. This doesn't work
with branches that are forked from revision 0. In case such a branch is
found, we now also feed the full revision.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2009-01-27 15:34:46 +01:00
Frej Drejhammar
d6cd058bb3 hg-fast-export: Point out that only local repos are supported
Signed-off-by: Frej Drejhammar <frej.drejhammar@gmail.com>
2009-01-16 20:09:52 +01:00
Rocco Rutte
9f278a9792 hg-fast-export: Update todo now that tag movement is supported
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2008-12-30 21:52:32 +01:00
Frej Drejhammar
276f54c38f Merge branch 'from-jmcmullan' into develop
Conflicts:
	hg-fast-export.py
2008-12-20 19:57:39 +01:00
Fabrizio Chiarello
a984e233c2 hg-fast-export: add option to track remote branches under a custom namespace
Add -o, --origin <name> to allow user to set a namespace used
when importing remote branches.

Signed-off-by: Fabrizio Chiarello <ponch@autistici.org>
2008-12-20 19:51:02 +01:00
Jason S. McMullan
b4833029a4 hg export: Support tag movement
HG tag movement is now supported with this patch.

This patch creates a .git/hg2git-mapping file, which maps
HG revision numbers to HG hashes. Combined with the
.git/hg2git-marks file, which maps HG revisions to GIT hashes,
we can now reprocess all tags at the end of each hg export
operation.
2008-12-11 09:05:05 -05:00
Rocco Rutte
fdbb1decaa hg2git: Update copyrights and maintainership information.
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2008-11-25 11:25:22 +01:00
Fabrizio Chiarello
1ab60e492b hg-fast-export: Make default branch customizable
Add -M, --default-branch <branch_name> to allow user to set
the default branch where to pull into

Signed-off-by: Fabrizio Chiarello <ponch@autistici.org>
2008-09-19 08:03:44 +02:00
Rocco Rutte
02bc08886f hg-fast-export: Catch up with mercurial crew API changes
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2008-09-19 08:01:53 +02:00
Peter Colberg
e8ba36aa3f hg-fast-export.py: Use appropriate file mode for symlinks. 2008-09-19 07:55:45 +02:00
Jonathan Nieder
8be4e6b3d0 hg-fast-export: work still if git-commands are not in PATH
In git 1.6.0, most git tools with a dash in the name will no
longer be installed in $bindir.  This patch makes hg-fast-export
use the "git <command>" form so it will work even if "git" is
the only piece of git machinery in the user's PATH.

On the other hand, the "git <command>" form does not help for
sourcing a shell script (with ".").  So use the full path to
source "git-sh-setup".

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
2008-07-31 07:18:16 +02:00
Rocco Rutte
205c76749a Revert "hg2git: Replaces space with "_" in branches name"
The get_branch() function's purpose is to detect whether a mercurial
branch name actually should be considered the default branch.

Sanitizing branch and tag names for git is done in sanitize_name().

Noted by Jonathan Nieder.

This reverts commit cdfdae36c8.
2008-06-03 13:53:08 +02:00
Jonathan Nieder
6e3872b6a0 hg-fast-export.py: sanitize tildes (~) in branch names
In git-check-ref-format (1), there is the following rule for refnames:

	3. It cannot have ASCII control character (i.e. bytes
	   whose values are lower than \040, or \177 DEL), space,
	   tilde ~, caret ^, colon :, question-mark ?, asterisk *,
	   or open bracket [ anywhere;

and indeed, this rule is enforced by "git fast-import". hg-fast-export
already checked for all of the visible characters listed except for ~
and converted them to underscores. For some reason the tilde was
forgotten. This patch makes good on the omission.

Note that control characters are still left alone.

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2008-06-03 08:49:57 +02:00
Rocco Rutte
d89b42a631 Clarify where 'HEAD' branch name comes from
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2008-05-30 13:44:07 +02:00