Commit Graph

399 Commits

Author SHA1 Message Date
Kyle J. McKay
1be636db36 hg-fast-export.py: do not sort merge commit parents
In a merge commit, the first parent is always the same parent that
would be recorded if the commit were not a merge and the other
parent(s) record the commit(s) being merged in.

Preserving this order is important so that log --first-parent works
properly and also so that the merge history is not distorted by an
incorrect permutation of the DAG.

Remove the code that sorts the merge parents based on node id so
that the correct DAG order is preserved.
2014-03-28 16:17:12 +01:00
frej
7937dfaad5 Merge pull request #23 from ritcheyer/master
checking for - and converting - backslashes

Thank you for your contribution!
2014-03-16 16:05:47 +01:00
Kyle J. McKay
8822aa34e9 hg-fast-export.py: improve authors file compatibility
The authors file format accepted by git-svnimport and git-cvsimport
actually allows blank lines and comment lines that start with '#'.

Ignore blank lines and lines starting with '#' as the first
non-whitespace character to be compatible with the authors file
format accepted by the referenced tools.
2014-03-16 16:00:42 +01:00
Kyle J. McKay
0e4142955a hg-fast-export.sh: clean up help text and support --help
Intercept -h/--help before git-sh-setup so the proper script name
can be shown instead of "hg fast-export.sh" which is wrong.

Reorder the long option descriptions to be in the same order as
the short usage since, as the help says, "argument order matters."
2014-03-16 16:00:42 +01:00
Kyle J. McKay
5fad4e4b99 hg-fast-export: support new --hgtags option
Add support for a new --hgtags option.  When given, any .hgtags
files that may be present are exported.

Normally this is not desirable.  However, when attempting to mimic
the actions of other hg exporters that always export any .hgtags
files this option can help produce matching export data.
2014-03-16 16:00:42 +01:00
Kyle J. McKay
b1d1265330 hg-fast-export.py: do not lose file mode changes
If the file mode changes (for example from 10644 to 10755), but the
actual text of the file itself does not, then the change could be
missed since the hashes would remain the same.

If the hashes match, also compare the gitmode values before deciding
the file is unchanged.
2014-03-16 16:00:42 +01:00
Kyle J. McKay
4be2fa46ee hg-fast-export.py: support older hg versions
Do not use the closesbranch function as it was added in later
versions of hg.  Use its definition instead.
2014-03-16 16:00:42 +01:00
Kyle J. McKay
728716375b hg-fast-export.py: restore compatibility with older python
Since hg runs and supports older versions of python, hg-fast-export.py
should too.  Replace dictionary comprehension with equivalent code that
supports versions of python older than 2.7.
2014-03-16 16:00:42 +01:00
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