Commit Graph

417 Commits

Author SHA1 Message Date
Frej Drejhammar
2d9b147a3e Remove obsolete and unsupported SVN tools
Hat tip to Sebastian Pipping for giving me a nudge to remove them.
2016-01-29 17:20:45 +01:00
Frej Drejhammar
f75057e49a Make --hg-hash work in incremental mode
When an import is restarted the first new note commit must use
refs/notes/hg^0 as the parent. As refs/notes/hg is only updated at the
end of a session we cannot have it present in all note commits. Neither
can we generate new marks for note commits as that would require a new
mapping scheme from hg versions numbers to git marks. A new mapping
scheme would break existing incremental import setups.

We therefore restructure the code to do the notes at the end of an
import session, thus only requiring a refs/notes/hg^0 reference in the
first commit.
2016-01-10 14:00:02 +01:00
Mark Raymond
042f0728cc Use backquotes 2015-12-12 10:34:02 +00:00
Mark Raymond
e7ea819a1f Use GitHub markdown 2015-12-12 10:25:31 +00:00
Mark Raymond
7d26b1a212 Rename README to README.md 2015-12-12 10:13:52 +00:00
Han Sangjin
38e81367ec Add filename encoding option --fe
In some locales Mercurial uses different encodings for commit messages
and file names. The --fe option allows the filename encoding to be
overridden.
2015-11-13 11:39:47 +01:00
Frej Drejhammar
3c27c693e1 Allow branches and tags to be remapped
Branch and tag names can now be renamed using a mechanism similar to the
-A option for author names.

-B specifies a mapping file for branch names, and -T a mapping file for
tags.
2015-08-16 17:13:04 +02:00
Frej Drejhammar
a542b6aa97 refactor: Make author map loading more generic
This is the first step in adding mappings for branches and tags.
2015-08-16 13:09:51 +02:00
Frej Drejhammar
b9b6f2a57a Survive corrupt source repositories
Apparently a bug (http://bz.selenic.com/show_bug.cgi?id=3511) in
multiple released versions of Mercurial could produce commits where
files had absolute paths.

As a "healthy" repo should not contain any absolute paths, it should be
safe to always strip a leading '/' from the path and let the conversion
continue.
2015-08-15 20:26:02 +02:00
zed
d202200fd9 Make -e option apply to imported filenames
When the -e option is given, convert imported filenames just as we do
for metadata and author information.
2014-11-01 15:54:05 +01:00
zed
e87c9cb3b8 Add option for specifying the text encoding used by Mercurial
When a mercurial repository does not use utf-8 for encoding author
strings and commit messages the "-e <encoding>" command line option
can be used to force fast-export to convert incoming meta data from
<encoding> to utf-8.

When "-e <encoding>" is given, we use Python's string
decoding/encoding API to convert meta data on the fly when processing
commits.
2014-10-25 22:39:08 +02:00
Frej Drejhammar
f64c10ba14 Do not rely on "type -p"
Apparently dash (used as bin/sh on Ubuntu) does not support type -p.

Thanks to Esben Madsen for noticing and suggesting a fix.
2014-09-23 15:01:02 +02:00
frej
8a8bd170f7 Merge pull request #37 from ottxor/master
Fix ROOT if hg-fast-export is in PATH
2014-09-19 13:39:31 +02:00
Christoph Junghans
a7c0da7eca Fix ROOT if hg-fast-export is in PATH
dirname $0 will return "." if hg-fast-export is in the path.
Use "type -p" to find the full path to the script.
2014-09-18 08:16:09 -06:00
Frej Drejhammar
2c21922ad1 Only dump heads in head cache
If there is a tag with the same name as a tag, "git rev-parse <name>"
can give the hash of the tag instead of the branch. "git rev-parse
refs/heads/<name>" must be used to make sure we only find branches.
2014-07-06 14:59:28 +02:00
Chris
29e19d696f Update README with note about no working directory
If you run the commands listed in usage

```bash
  mkdir repo-git # or whatever
  cd repo-git
  git init
  hg-fast-export.sh -r <repo>
```

you are not given a working directory to start working in. I was
caught off-guard by this when I ran `git status` and everything in the
repo was listed as deleted. A quick google search indicates I'm not
the only one who was surprised.
2014-05-30 13:36:48 +02:00
Piotr Święcicki
1d85321bdb Annotate commits with the hg hash as git notes in the hg namespace
If the --hg-hash argument is given, the converted commits are
annotated with the original hg hash as a git note in the "hg"
namespace.

The notes can be shown by git log using the "--notes=hg" argument.
2014-05-02 16:57:03 +02:00
Kyle J. McKay
779e2f6da8 hg-fast-export.sh/hg-reset.sh: replace egrep with grep
According to the POSIX standard, egrep is an obsolescent equivalent
of grep -E.  In fact, the patterns actually being used with egrep do
not require use of extended regular expressions at all, so a plain
'grep' can be used rather than 'grep -E'.

Replace egrep with grep to improve compatibility across systems.
2014-04-13 15:40:07 +02:00
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