Skip to content

Commit ebf4b28

Browse files
committed
import-hg: Update example to work with a current hg-fast-export
Version 171002 of hg-fast-export changed the format of mapping files to allow arbitrary strings as input and output. Therefore update the example and the description of the format to avoid user confusion (frej/fast-export#116).
1 parent 8ce6944 commit ebf4b28

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

book/09-git-and-other-scms/sections/import-hg.asc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,18 @@ Joe Smith <[email protected]>
3838
----
3939

4040
In this example, the same person (Bob) has created changesets under four different names, one of which actually looks correct, and one of which would be completely invalid for a Git commit.
41-
Hg-fast-export lets us fix this by adding `={new name and email address}` at the end of every line we want to change, and removing the lines for any usernames that we want to leave alone.
41+
Hg-fast-export lets us fix this by turning each line into a rule: `"<input>"="<output>"`, mapping an `<input>` to an `<output>`.
42+
Inside the `<input>` and `<output>` strings, all escape sequences understood by the python `string_escape` encoding are supported.
43+
If the author mapping file does not contain a matching `<input>`, that author will be sent on to Git unmodified.
4244
If all the usernames look fine, we won't need this file at all.
4345
In this example, we want our file to look like this:
4446

4547
[source]
4648
----
47-
bob=Bob Jones <[email protected]>
48-
bob@localhost=Bob Jones <[email protected]>
49-
50-
bob jones <bob <AT> company <DOT> com>=Bob Jones <[email protected]>
49+
"bob"="Bob Jones <[email protected]>"
50+
"bob@localhost"="Bob Jones <[email protected]>"
51+
52+
"bob jones <bob <AT> company <DOT> com>"="Bob Jones <[email protected]>"
5153
----
5254

5355
The next step is to create our new Git repository, and run the export script:

0 commit comments

Comments
 (0)