You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/09-git-and-other-scms/sections/import-hg.asc
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,31 +1,31 @@
1
1
==== Mercurial
2
2
3
-
(((Mercurial)))(((Importing, from Mercurial)))
4
-
Since Mercurial and Git have fairly similar models for representing versions, and since Git is a bit more flexible, converting a repository from Mercurial to Git is fairly straightforward, using a tool called "hg-fast-export", which you'll need a copy of:
3
+
(((Mercurial)))(((Εισαγωγή, από Mercurial)))
4
+
Δεδομένου ότι τα Mercurial και Git έχουν αρκετά παρόμοια μοντέλα για να αναπαριστούν τις εκδόσεις και καθώς το Git είναι λίγο πιο ευέλικτο, η μετατροπή ενός αποθετηρίου από το Mercurial στο Git είναι αρκετά απλή, χάρη σε ένα εργαλείο που ονομάζεται `hg-fast-export`, το οποιο θα χρειαστούμε:
The first step in the conversion is to get a full clone of the Mercurial repository you want to convert:
11
+
Το πρώτο βήμα της μετατροπής είναι να αποκτήσουμε έναν πλήρη κλώνο του αποθετηρίου Mercurial που θέλουμε να μετατρέψουμε:
12
12
13
13
[source,console]
14
14
----
15
15
$ hg clone <remote repo URL> /tmp/hg-repo
16
16
----
17
17
18
-
The next step is to create an author mapping file.
19
-
Mercurial is a bit more forgiving than Git for what it will put in the author field for changesets, so this is a good time to clean house.
20
-
Generating this is a one-line command in a `bash` shell:
18
+
Το επόμενο βήμα είναι να δημιουργήσουμε ένα αρχείο αντιστοίχισης των συγγραφέων.
19
+
Το Mercurial είναι λίγο πιο συγχωρητικό από το Git όσον αφορά σε αυτά που θα θέσει στο πεδίο author για το σύνολο των αλλαγών, γι 'αυτό είναι μια καλή ευκαιρία για ένα μικρό συμμάζεμα.
20
+
Το συμμάζεμα είναι μία εντολή της μιας γραμμής στο κέλυφος `bash`:
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.
42
-
If all the usernames look fine, we won't need this file at all.
43
-
In this example, we want our file to look like this:
40
+
Σε αυτό το παράδειγμα, το ίδιο άτομο (Bob) δημιούργησε σύνολα αλλαγών κάτω από τέσσερα διαφορετικά ονόματα, ένα από τα οποία φαίνεται πραγματικά σωστό και ένα από τα οποία θα ήταν εντελώς άκυρο για μια υποβολή Git.
41
+
Η `hg-fast-export` μάς επιτρέπει να το διορθώσουμε προσθέτοντας`={νέο όνομα και νέα διεύθυνση e-mail}`στο τέλος κάθε γραμμής που θέλουμε να αλλάξουμε και αφαιρώντας τις γραμμές για όλα τα ονόματα χρήστη που θέλουμε να αφήσουμε ανέγγιχτα.
42
+
Αν όλα τα ονόματα χρηστών φαίνονται ωραία, δεν θα χρειαστεί καθόλου αυτό το αρχείο.
43
+
Σε αυτό το παράδειγμα, θέλουμε το αρχείο μας να μοιάζει με αυτό:
44
44
45
45
[source]
46
46
----
@@ -50,7 +50,7 @@ bob jones <bob <AT> company <DOT> com>=Bob Jones <[email protected]>
The next step is to create our new Git repository, and run the export script:
53
+
Το επόμενο βήμα είναι να δημιουργήσουμε το νέο μας αποθετήριο Git και να εκτελέσουμε το script εξαγωγής:
54
54
55
55
[source,console]
56
56
----
@@ -59,9 +59,9 @@ $ cd /tmp/converted
59
59
$ /tmp/fast-export/hg-fast-export.sh -r /tmp/hg-repo -A /tmp/authors
60
60
----
61
61
62
-
The `-r`flag tells hg-fast-export where to find the Mercurial repository we want to convert, and the`-A`flag tells it where to find the author-mapping file.
63
-
The script parses Mercurial changesets and converts them into a script for Git's "fast-import" feature (which we'll discuss in detail a bit later on).
64
-
This takes a bit (though it's _much_ faster than it would be over the network), and the output is fairly verbose:
62
+
Η σημαία `-r`λέει στο `hg-fast-export` πού θα βρει το αποθετήριο Mercurial που θέλουμε να μετατρέψουμε και η σημαία`-A`του λέει πού θα βρει το αρχείο αντιστοίχισης των συγγραφέων.
63
+
Το script αναλύει τα σύνολα αλλαγών του Mercurial changesets και τα μετατρέπει σε ένα script για τη λειτουργία ``γρήγορης εισαγωγής'' του Git (η οποία θα συζητηθεί λεπτομερώς λίγο αργότερα).
64
+
Αυτό διαρκεί λιγάκι (αν και είναι πολύ πιο γρήγορα από ό,τι θα ήταν πάνω από το δίκτυο) και η έξοδος είναι αρκετά λεπτομερής:
65
65
66
66
[source,console]
67
67
----
@@ -109,9 +109,9 @@ $ git shortlog -sn
109
109
365 Joe Smith
110
110
----
111
111
112
-
That's pretty much all there is to it.
113
-
All of the Mercurial tags have been converted to Git tags, and Mercurial branches and bookmarks have been converted to Git branches.
114
-
Now you're ready to push the repository up to its new server-side home:
112
+
Σε γενικές γραμμές αυτό ήταν όλο.
113
+
Όλες οι ετικέτες του Mercurial έχουν μετατραπεί σε ετικέτες Git και τα οι κλάδοι και σελιδοδείκτες του Mercurial έχουν μετατραπεί σε κλάδους του Git.
114
+
Τώρα είμαστε έτοιμοι να ωθήσουμε το αποθετήριο μέχρι το νέο του σπίτι του στο διακομιστή:
0 commit comments