Skip to content

Commit 6d8c79c

Browse files
authored
Merge pull request #19 from max123kl/chapter-09-2
Chapter 09-2
2 parents 4d7c8ae + db95420 commit 6d8c79c

File tree

2 files changed

+81
-81
lines changed

2 files changed

+81
-81
lines changed

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

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
==== Git and Mercurial
1+
==== Git und Mercurial
22

33
(((Interoperation with other VCSs, Mercurial)))
44
(((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.
88

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.
1212

1313
===== git-remote-hg
1414

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:
1717

1818
[source,console]
1919
----
@@ -22,35 +22,35 @@ $ curl -o ~/bin/git-remote-hg \
2222
$ chmod +x ~/bin/git-remote-hg
2323
----
2424

25-
assuming `~/bin` is in your `$PATH`.
26-
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:
2828

2929
[source,console]
3030
----
3131
$ pip install mercurial
3232
----
3333

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.)
3535

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.
3838

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:
4242

4343
[source,console]
4444
----
4545
$ hg clone http://selenic.com/repo/hello /tmp/hello
4646
----
4747

48-
===== Getting Started
48+
===== Erste Schritte
4949

50-
Now that we have a suitable ``server-side'' repository, we can go through a typical workflow.
51-
As you'll see, these two systems are similar enough that there isn't much friction.
50+
Nun, da wir über ein geeignetes „serverseitiges“ Repository verfügen, können wir einen typischen Workflow durchlaufen.
51+
Wie Sie sehen werden, sind diese beiden Systeme ähnlich genug, dass es keine große Überschneidungen gibt.
5252

53-
As always with Git, first we clone:
53+
Wie immer mit Git, wir klonen zuerst:
5454

5555
[source,console]
5656
----
@@ -61,13 +61,13 @@ $ git log --oneline --graph --decorate
6161
* 65bb417 Create a standard "hello, world" program
6262
----
6363

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.
6767

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:
7171

7272
[source,console]
7373
----
@@ -91,13 +91,13 @@ $ tree .git/refs
9191
9 directories, 5 files
9292
----
9393

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.
9898

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:
101101

102102
[source,console]
103103
----
@@ -119,28 +119,28 @@ $ git cat-file -p ac9117f
119119
0a04b987be5ae354b710cefeba0e2d9de7ad41a9
120120
----
121121

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).
125125

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.
128128

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:
132132

133133
[source,console]
134134
----
135135
$ cp .hgignore .git/info/exclude
136136
----
137137

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.
139139

140140
===== Workflow
141141

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.
143+
Nun sieht unser Repository momentan so aus:
144144

145145
[source,console]
146146
----
@@ -151,8 +151,8 @@ $ git log --oneline --graph --decorate
151151
* 65bb417 Create a standard "hello, world" program
152152
----
153153

154-
Our `master` branch is two commits ahead of `origin/master`, but those two commits exist only on our local machine.
155-
Let's see if anyone else has been doing important work at the same time:
154+
Unser `master` Branch ist zwei Commits vor dem `origin/master`, aber diese beiden Commits existieren nur auf unserem lokalen Rechner.
155+
Schauen wir mal nach, ob jemand anderes zur gleichen Zeit wichtige Arbeit geleistet hat:
156156

157157
[source,console]
158158
----
@@ -171,9 +171,9 @@ $ git log --oneline --graph --decorate --all
171171
* 65bb417 Create a standard "hello, world" program
172172
----
173173

174-
Since we used the `--all` flag, we see the ``notes'' refs that are used internally by git-remote-hg, but we can ignore them.
175-
The rest is what we expected; `origin/master` has advanced by one commit, and our history has now diverged.
176-
Unlike the other systems we work with in this chapter, Mercurial is capable of handling merges, so we're not going to do anything fancy.
174+
Da wir das `--all` Flag verwendet haben, sehen wir die „notes“ Refs, die intern von git-remote-hg verwendet werden, die wir aber ignorieren können.
175+
Den Rest haben wir erwartet. `origin/master` ist um einen Commit fortgeschritten. Unser Verlauf hat sich dadurch verändert.
176+
Anders als bei anderen Systemen, mit denen wir in diesem Kapitel arbeiten, ist Mercurial in der Lage, Merges zu verarbeiten, so dass wir nichts Ausgefallenes tun müssen.
177177

178178
[source,console]
179179
----
@@ -193,8 +193,8 @@ $ git log --oneline --graph --decorate
193193
* 65bb417 Create a standard "hello, world" program
194194
----
195195

196-
Perfect.
197-
We run the tests and everything passes, so we're ready to share our work with the rest of the team:
196+
Perfekt.
197+
Wir führen die Tests durch und alles passt, also sind wir so weit, dass wir unsere Arbeit mit dem Rest des Teams teilen können:
198198

199199
[source,console]
200200
----
@@ -203,8 +203,8 @@ To hg::/tmp/hello
203203
df85e87..0c64627 master -> master
204204
----
205205

206-
That's it!
207-
If you take a look at the Mercurial repository, you'll see that this did what we'd expect:
206+
Das wars!
207+
Wenn Sie einen Blick auf das Mercurial-Repository werfen, werden Sie feststellen, dass genau das getan wurde, was wir erwarten durften:
208208

209209
[source,console]
210210
----
@@ -228,16 +228,16 @@ o 0 0a04b987be5a 2005-08-26 01:20 -0700 mpm
228228
Create a standard "hello, world" program
229229
----
230230

231-
The changeset numbered _2_ was made by Mercurial, and the changesets numbered _3_ and _4_ were made by git-remote-hg, by pushing commits made with Git.
231+
Das Change-Set mit der Nummer _2_ wurde von Mercurial vorgenommen, und die Change-Sets mit der Nummer _3_ und _4_ wurden von git-remote-hg durchgeführt, indem Commits mit Git gepusht wurden.
232232

233-
===== Branches and Bookmarks
233+
===== Branches und Bookmarks
234234

235-
Git has only one kind of branch: a reference that moves when commits are made.
236-
In Mercurial, this kind of a reference is called a ``bookmark,'' and it behaves in much the same way as a Git branch.
235+
Git hat nur eine Art von Branch: eine Referenz, die sich verschiebt, wenn Commits gemacht werden.
236+
In Mercurial wird diese Art von Referenz als „bookmark“ (dt. Lesezeichen) bezeichnet, und sie verhält sich ähnlich wie ein Git-Branch.
237237

238-
Mercurial's concept of a ``branch'' is more heavyweight.
239-
The branch that a changeset is made on is recorded _with the changeset_, which means it will always be in the repository history.
240-
Here's an example of a commit that was made on the `develop` branch:
238+
Das Konzept von Mercurial eines „Branchs“ ist höher gewichtet.
239+
Der Branch, auf den ein Changeset durchgeführt wird, wird _zusammen mit dem Changeset_ aufgezeichnet, d.h. er befindet sich immer im Repository-Verlauf.
240+
Hier ist ein Beispiel für einen Commit, der auf dem `develop` Branch gemacht wurde:
241241

242242
[source,console]
243243
----
@@ -250,11 +250,11 @@ date: Thu Aug 14 20:06:38 2014 -0700
250250
summary: More documentation
251251
----
252252

253-
Note the line that begins with ``branch''.
254-
Git can't really replicate this (and doesn't need to; both types of branch can be represented as a Git ref), but git-remote-hg needs to understand the difference, because Mercurial cares.
253+
Achten Sie darauf, dass die Zeile mit „branch“ beginnt.
254+
Git kann das nicht wirklich nachahmen (und muss es auch nicht; beide Arten von Zweigen können als Git ref dargestellt werden), aber git-remote-hg muss den Unterschied erkennen, denn für Mercurial ist er wichtig.
255255

256-
Creating Mercurial bookmarks is as easy as creating Git branches.
257-
On the Git side:
256+
Das Anlegen von Mercurial-Lesezeichen ist so einfach wie das Erstellen von Git-Branches.
257+
Auf der Seite vom Git machen Sie:
258258

259259
[source,console]
260260
----
@@ -265,8 +265,8 @@ To hg::/tmp/hello
265265
* [new branch] featureA -> featureA
266266
----
267267

268-
That's all there is to it.
269-
On the Mercurial side, it looks like this:
268+
Das ist alles, was es dazu zu sagen gibt.
269+
Auf der Mercurial-Seite sieht es dann folgendermaßen aus:
270270

271271
[source,console]
272272
----
@@ -295,10 +295,10 @@ o 0 0a04b987be5a 2005-08-26 01:20 -0700 mpm
295295
Create a standard "hello, world" program
296296
----
297297

298-
Note the new `[featureA]` tag on revision 5.
299-
These act exactly like Git branches on the Git side, with one exception: you can't delete a bookmark from the Git side (this is a limitation of remote helpers).
298+
Beachten Sie den neuen `[featureA]` Tag auf Revision 5.
299+
Die verhalten sich genau wie Git-Branches auf der Git-Seite, mit einer Ausnahme: Sie können ein Lesezeichen auf der Git-Seite nicht löschen (das ist eine Einschränkung des Remote-Helfers).
300300

301-
You can work on a ``heavyweight'' Mercurial branch also: just put a branch in the `branches` namespace:
301+
Sie können auch an einem „schwergewichtigen“ Mercurial-Branch arbeiten: Bringen Sie einfach einen Branch in den `branches` Namensraum:
302302

303303
[source,console]
304304
----
@@ -311,7 +311,7 @@ To hg::/tmp/hello
311311
* [new branch] branches/permanent -> branches/permanent
312312
----
313313

314-
Here's what that looks like on the Mercurial side:
314+
So sieht das dann auf der Mercurial-Seite aus:
315315

316316
[source,console]
317317
----
@@ -344,11 +344,11 @@ o changeset: 5:bd5ac26f11f9
344344
[...]
345345
----
346346

347-
The branch name ``permanent'' was recorded with the changeset marked _7_.
347+
Der Branch-Name „permanent“ wurde mit dem Change-Set _7_ eingetragen.
348348

349-
From the Git side, working with either of these branch styles is the same: just checkout, commit, fetch, merge, pull, and push as you normally would.
350-
One thing you should know is that Mercurial doesn't support rewriting history, only adding to it.
351-
Here's what our Mercurial repository looks like after an interactive rebase and a force-push:
349+
Seitens von Git ist die Arbeit mit einem dieser Branch-Stile die gleiche: Einfach auschecken, committen, fetchen, mergen, pullen, und pushen, wie Sie es üblicherweise machen würden.
350+
Eine Sache, die Sie wissen sollten, ist, dass Mercurial das Überschreiben der Historie nicht unterstützt, sondern nur hinzufügt.
351+
Das Mercurial-Repository sieht nach einem interaktiven Rebase und einem Force-Push so aus:
352352

353353
[source,console]
354354
----
@@ -387,11 +387,11 @@ o 0 0a04b987be5a 2005-08-26 01:20 -0700 mpm
387387
Create a standard "hello, world" program
388388
----
389389

390-
Changesets _8_, _9_, and _10_ have been created and belong to the `permanent` branch, but the old changesets are still there.
391-
This can be *very* confusing for your teammates who are using Mercurial, so try to avoid it.
390+
Die Changesets _8_, _9_ und _10_ wurden angelegt und gehören zum `permanent` Branch, aber die alten Changesets sind immer noch vorhanden.
391+
Das kann für Ihre Teamkollegen, die Mercurial verwenden, *sehr verwirrend* sein, also versuchen Sie es zu vermeiden.
392392

393393

394-
===== Mercurial Summary
394+
===== Mercurial Zusammenfassung
395395

396-
Git and Mercurial are similar enough that working across the boundary is fairly painless.
397-
If you avoid changing history that's left your machine (as is generally recommended), you may not even be aware that the other end is Mercurial.
396+
Git und Mercurial sind sich ähnlich genug, um über die eigene Umgebung hinaus schmerzlos zu arbeiten.
397+
Wenn Sie vermeiden, den Verlauf zu ändern, der Ihren Computer verlässt (was allgemein empfohlen wird), merken Sie wahrscheinlich nicht einmal, dass am anderen Ende Mercurial verwendet wird.

status.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
},
8686
"09-git-and-other-scms": {
8787
"1-git-and-other-scms.asc": 100,
88-
"sections/client-hg.asc": 0,
88+
"sections/client-hg.asc": 100,
8989
"sections/client-p4.asc": 0,
9090
"sections/client-svn.asc": 100,
9191
"sections/client-tfs.asc": 0,

0 commit comments

Comments
 (0)