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/client-hg.asc
+45-45Lines changed: 45 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,19 @@
1
-
==== Git and Mercurial
1
+
==== Git und Mercurial
2
2
3
3
(((Interoperation with other VCSs, Mercurial)))
4
4
(((Mercurial)))
5
-
The DVCS universe is larger than just Git.
6
-
In fact, there are many other systems in this space, each with their own angle on how to do distributed version control correctly.
7
-
Apart from Git, the most popular is Mercurial, and the two are very similar in many respects.
5
+
Das DVCS-Universum besteht nicht nur aus nur Git.
6
+
In diesem Bereich gibt es viele andere Systeme, jedes hat seinen eigenen Ansatz, wie eine verteilte Versionskontrolle zu funktionieren hat.
7
+
Neben Git ist Mercurial am populärsten und die beiden sind sich in vielerlei Hinsicht sehr ähnlich.
8
8
9
-
The good news, if you prefer Git's client-side behavior but are working with a project whose source code is controlled with Mercurial, is that there's a way to use Git as a client for a Mercurial-hosted repository.
10
-
Since the way Git talks to server repositories is through remotes, it should come as no surprise that this bridge is implemented as a remote helper.
11
-
The project's name is git-remote-hg, and it can be found at https://github.com/felipec/git-remote-hg[].
9
+
Die gute Nachricht, wenn Sie Gits clientseitiges Verhalten bevorzugen, aber mit einem Projekt arbeiten, dessen Quellcode mit Mercurial verwaltet wird, dann ist es möglich, Git als Client für ein von Mercurial gehostetes Repository zu verwenden.
10
+
Da die Art und Weise, wie Git über Remotes mit Server-Repositories kommuniziert, sollte es nicht überraschen, dass diese Bridge als Remote-Helfer implementiert ist.
11
+
Der Name des Projekts lautet git-remote-hg und ist unter https://github.com/felipec/git-remote-hg[] zu finden.
12
12
13
13
===== git-remote-hg
14
14
15
-
First, you need to install git-remote-hg.
16
-
This basically entails dropping its file somewhere in your path, like so:
15
+
Zuerst müssen Sie git-remote-hg installieren.
16
+
Im Wesentlichen geht es darum, die Datei irgendwo in Ihrem Pfad abzulegen, so wie hier:
Git-remote-hg has one other dependency: the `mercurial` library for Python.
27
-
If you have Python installed, this is as simple as:
25
+
…vorausgesetzt (in einer Linux-Umgebung), `~/bin` ist in Ihrem `$PATH`.
26
+
Git-remote-hg hat noch eine weitere Abhängigkeit: die `mercurial` Library für Python.
27
+
Wenn Sie Python installiert schon haben, ist das einfach:
28
28
29
29
[source,console]
30
30
----
31
31
$ pip install mercurial
32
32
----
33
33
34
-
(If you don't have Python installed, visit https://www.python.org/[] and get it first.)
34
+
(Wenn Sie Python noch nicht installiert haben, besuchen Sie https://www.python.org/[] und besorgen Sie es sich zuerst.)
35
35
36
-
The last thing you'll need is the Mercurial client.
37
-
Go to https://www.mercurial-scm.org/[] and install it if you haven't already.
36
+
Als Letztes brauchen Sie den Mercurial-Client.
37
+
Gehen Sie zu https://www.mercurial-scm.org/[] und installieren Sie ihn, falls Sie es noch nicht getan haben.
38
38
39
-
Now you're ready to rock.
40
-
All you need is a Mercurial repository you can push to.
41
-
Fortunately, every Mercurial repository can act this way, so we'll just use the "hello world" repository everyone uses to learn Mercurial:
39
+
Jetzt sind Sie bereit zu abrocken.
40
+
Alles, was Sie benötigen, ist ein Mercurial-Repository, auf das Sie zugreifen können.
41
+
Glücklicherweise kann sich jedes Mercurial-Repository so verhalten, also verwenden wir einfach das "hello world"-Repository, das jeder benutzt, um Mercurial zu lernen:
* 65bb417 Create a standard "hello, world" program
62
62
----
63
63
64
-
You'll notice that working with a Mercurial repository uses the standard `git clone` command.
65
-
That's because git-remote-hg is working at a fairly low level, using a similar mechanism to how Git's HTTP/S protocol is implemented (remote helpers).
66
-
Since Git and Mercurial are both designed for every client to have a full copy of the repository history, this command makes a full clone, including all the project's history, and does it fairly quickly.
64
+
Wie Sie sehen, verwendet man bei der Arbeit mit einem Mercurial-Repository den Standardbefehl `git clone`.
65
+
Das liegt daran, dass git-remote-hg auf einem relativ niedrigen Level arbeitet und einen ähnlichen Mechanismus verwendet, wie es die Implementierung des HTTP/S-Protokolls in Git ist (Remote-Helfer).
66
+
Da Git und Mercurial beide so konzipiert sind, dass jeder Client eine vollständige Kopie der Repository-Historie hat, erstellt dieser Befehl relativ schnell einen vollständigen Klon, einschließlich der gesamten Projekthistorie.
67
67
68
-
The log command shows two commits, the latest of which is pointed to by a whole slew of refs.
69
-
It turns out some of these aren't actually there.
70
-
Let's take a look at what's actually in the `.git` directory:
68
+
Der log-Befehl zeigt zwei Commits, von denen der letzte von einer ganzen Reihe von Refs angeführt wird.
69
+
Wie sich herausstellt, sind einige davon nicht wirklich da.
70
+
Werfen wir einen Blick darauf, was sich wirklich im `.git` Verzeichnis befindet:
71
71
72
72
[source,console]
73
73
----
@@ -91,13 +91,13 @@ $ tree .git/refs
91
91
9 directories, 5 files
92
92
----
93
93
94
-
Git-remote-hg is trying to make things more idiomatically Git-esque, but under the hood it's managing the conceptual mapping between two slightly different systems.
95
-
The `refs/hg` directory is where the actual remote refs are stored.
96
-
For example, the `refs/hg/origin/branches/default` is a Git ref file that contains the SHA-1 starting with ``ac7955c'', which is the commit that `master` points to.
97
-
So the `refs/hg` directory is kind of like a fake `refs/remotes/origin`, but it has the added distinction between bookmarks and branches.
94
+
Git-remote-hg versucht sich idiomatisch (begrifflich) an Git anzunähern, aber im Hintergrund verwaltet es die konzeptionelle Zuordnung zwischen zwei leicht unterschiedlichen Systemen.
95
+
Im Verzeichnis `refs/hg` werden die aktuellen Remote-Referenzen gespeichert.
96
+
Zum Beispiel ist die `refs/hg/origin/branches/default` eine Git ref-Datei, die das SHA-1 enthält und mit „ac7955c“ beginnt. Das ist der Commit, auf den `master` zeigt.
97
+
Das Verzeichnis `refs/hg` ist also eine Art gefälschtes `refs/remotes/origin`, aber es unterscheidet zusätzlich zwischen Lesezeichen und Zweigen.
98
98
99
-
The `notes/hg` file is the starting point for how git-remote-hg maps Git commit hashes to Mercurial changeset IDs.
100
-
Let's explore a bit:
99
+
Die Datei `notes/hg` ist der Ausgangspunkt dafür, wie git-remote-hg Git-Commit-Hashes auf Mercurial-Changeset-IDs abbildet.
100
+
Lassen Sie uns ein wenig experimentieren:
101
101
102
102
[source,console]
103
103
----
@@ -119,28 +119,28 @@ $ git cat-file -p ac9117f
119
119
0a04b987be5ae354b710cefeba0e2d9de7ad41a9
120
120
----
121
121
122
-
So `refs/notes/hg` points to a tree, which in the Git object database is a list of other objects with names.
123
-
`git ls-tree` outputs the mode, type, object hash, and filename for items inside a tree.
124
-
Once we dig down to one of the tree items, we find that inside it is a blob named ``ac9117f'' (the SHA-1 hash of the commit pointed to by `master`), with contents ``0a04b98'' (which is the ID of the Mercurial changeset at the tip of the `default` branch).
122
+
So zeigt refs/notes/hg auf einen Verzeichnisbaum, der in der Git-Objektdatenbank eine Liste anderer Objekte mit Namen ist.
123
+
`git ls-tree` gibt Modus, Typ, Objekt-Hash und Dateiname für Elemente innerhalb eines Baums aus.
124
+
Sobald wir uns auf eines der Baumelemente festgelegt haben, stellen wir fest, dass sich darin ein „ac9117f“ Blob (der SHA-1-Hash des Commit, auf den `master` zeigt) befindet. Inhaltlich ist er identisch mit "0a04b98" (das ist die ID des Mercurial-Changesets an der Spitze der `default` Branch).
125
125
126
-
The good news is that we mostly don't have to worry about all of this.
127
-
The typical workflow won't be very different from working with a Git remote.
126
+
Die gute Nachricht ist, dass wir uns darüber meistens keine Sorgen machen müssen.
127
+
Der typische Arbeitsablauf unterscheidet sich nicht wesentlich von der Arbeit mit einem Git-Remote.
128
128
129
-
There's one more thing we should attend to before we continue: ignores.
130
-
Mercurial and Git use a very similar mechanism for this, but it's likely you don't want to actually commit a `.gitignore` file into a Mercurial repository.
131
-
Fortunately, Git has a way to ignore files that's local to an on-disk repository, and the Mercurial format is compatible with Git, so you just have to copy it over:
129
+
Noch eine Besonderheit, um die wir uns kümmern sollten, bevor wir fortfahren: Die Auslassungen.
130
+
Mercurial und Git verwenden dafür einen sehr ähnlichen Mechanismus, aber es ist durchaus möglich, dass Sie eine `.gitignore` Datei nicht wirklich in ein Mercurial Repository übertragen wollen.
131
+
Glücklicherweise hat Git eine Möglichkeit, Dateien zu ignorieren, die lokal in einem On-Disk-Repository liegen. Das Mercurial-Format ist kompatibel mit Git, so dass Sie es nur kopieren müssen:
132
132
133
133
[source,console]
134
134
----
135
135
$ cp .hgignore .git/info/exclude
136
136
----
137
137
138
-
The `.git/info/exclude` file acts just like a `.gitignore`, but isn't included in commits.
138
+
Die Datei `.git/info/exclude` verhält sich wie eine `.gitignore`, wird aber nicht in den Commits aufgenommen.
139
139
140
140
===== Workflow
141
141
142
-
Let's assume we've done some work and made some commits on the `master` branch, and you're ready to push it to the remote repository.
143
-
Here's what our repository looks like right now:
142
+
Nehmen wir an, wir haben einige Arbeiten erledigt und einige Commits auf den `master` Branch gemacht und Sie sind so weit, ihn in das Remote-Repository zu pushen.
0 commit comments