Differences between revisions 6 and 16 (spanning 10 versions)
Revision 6 as of 2008-01-30 15:21:04
Size: 5724
Editor: ThiloPfennig
Comment: noch ein Satz
Revision 16 as of 2013-08-27 17:02:08
Size: 366
Editor: JeanetteH
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#language de

== Tutorial - Eine erste Änderung durchführen ==

Wir bauen auf GermanTutorialHistory auf und befinden uns in unserem {{{my-hello}}}-Repository, dass wir in GermanTutorialClone geklont haben.

Es ist gute Praxis beim Entwickeln mit ["Mercurial"], jede Änderung isoliert in einem separaten ["Repository"] durchzuführen. Damit vermeidet man, dass nicht zusammengehöriger Code vermischt wird und es das Ergebnis nicht zusammengehöriger Arbeitsschritte lässt sich leichter testen. XXX Let's start out by following that model.

Unser simples Ziel ist es das "Hallo Welt!" Program dazu zu bringen eine weitere Zeile auszugeben. Als erstes erzeugen wir ein neues Repository, das wir {{{my-hello-new-output}}} nennen, in dem wir von {{{my-hello}}} für unser kleines Projekt klonen.

{{{
$ cd ..
$ hg clone my-hello my-hello-new-output
}}}

In diesem Falle wird der "clone"-Befehl nichts ausgeben, wenn er erfolgreich ist.

''Hinweis:''' Beachte, das wir unserem neuen ["Repository"] einen beschreibenden Namen gegeben haben, der den grundsätzlichen Zweck des ["Repository"] beschreibt. Da das [:Clone:Klonen] eines ["Repository"] in ["Mercurial"] "billig" ist, werden wir bald eine Menge etwas unterschiedlicher Repositoriesg ansammeln. Wenn wir diesen keine beschreibenden Namen geben, werden wir schnell Probleme haben, diese auseinander zu halten.

Now it's time to make a change in the new repository. Let's go into the WorkingDirectory, which is simply our name for the directory where all the files are, and modify the source code with our favorite editor:

{{{
$ cd my-hello-new-output
$ vi hello.c
}}}

The contents of {{{hello.c}}} initially look like this:

{{{#!cplusplus numbers=off
/*
 * hello.c
 *
 * Placed in the public domain by Bryan O'Sullivan
 *
 * This program is not covered by patents in the United States or other
 * countries.
 */

#include <stdio.h>

int main(int argc, char **argv)
{
        printf("hello, world!\n");
        return 0;
}
}}}

Let's edit {{{main}}} so that it prints an extra line of output:

{{{#!cplusplus numbers=off
(...)

int main(int argc, char **argv)
{
        printf("hello, world!\n");
        printf("sure am glad I'm using Mercurial!\n");
        return 0;
}
}}}

Once we're done, we quit out of our favorite editor, and we're done. That's it. The edit is now ready for us to create a ChangeSet.

But what if we're interrupted, and we've forgotten what changes are going to make it into the ChangeSet once we create it? For this, we use the {{{status}}} command.

{{{
$ hg status
M hello.c
}}}

The output is terse, but prefix {{{M}}} is simply telling us that {{{hello.c}}} has been modified, so our change is ready to go into a ChangeSet.

We may also examine the actual changes we have made to the file using the {{{diff}}} command:

{{{
$ hg diff
diff -r 82e55d328c8c hello.c
--- a/hello.c Fri Aug 26 01:21:28 2005 -0700
+++ b/hello.c Fri Sep 30 10:27:47 2005 +0800
@@ -12,5 +12,6 @@
 int main(int argc, char **argv)
 {
        printf("hello, world!\n");
+ printf("sure am glad I'm using Mercurial!\n");
        return 0;
 }
}}}

<!> In case we wish to '''discard''' our changes and start over, we may use the {{{revert}}} command to restore hello.c to its unmodified state (or use the -a option to revert all files). Just make sure you know this is what you really want.

{{{
$ hg revert hello.c
}}}

The act of creating a ChangeSet is called ["Commit"]ting it. We perform a ["Commit"] using the {{{commit}}} command:

{{{
$ hg commit
}}}

This drops us into an editor, and presents us with a few cryptic lines of text.

'''Note:''' The default editor is {{{vi}}}. This can be changed using the {{{EDITOR}}} or {{{HGEDITOR}}} environment variables. Also, the manifest hash might be different, depending on how you typed and saved the file.

{{{
(empty line)
HG: manifest hash 14595beb70bcfb74bf227437d70c38878421c944
HG: changed hello.c
}}}

The first line is empty and the lines that follow identify the files that will go into this ChangeSet.

To ["Commit"] the ChangeSet, we must describe the reason for it. This is usually called a ChangeSet comment. Let's type something like this:

{{{
Express great joy at existence of Mercurial
HG: manifest hash 14595beb70bcfb74bf227437d70c38878421c944
HG: changed hello.c
}}}

Next, we save the test and quit the editor, and, if all goes well, the {{{commit}}} command will exit and prints no output. <!> If you quit the editor without saving the text, {{{commit}}} will abort the operation, so you may change your mind before committing.

'''Note:''' Before committing anything into a serious project, you may want to configure a meaningful username in {{{~/.hgrc}}}; see ["QuickStart2"].

Let's see what the {{{status}}} command will tell us now?

{{{
$ hg status
}}}

Nothing! Our change has been ["Commit"]ted to a ChangeSet, so there's no modified file in need of a commit. Our ["Tip"] now matches our working directory contents.

We can now examine the change history for our new work:
{{{
$ hg log
changeset: 2:a58809af174d
tag: tip
user: mpm@selenic.com
date: Fri Aug 26 01:26:28 2005 -0700
summary: Express great joy at existence of Mercurial

(...)
}}}

There it is! We've ["Commit"]ted a ChangeSet.

'''Note:''' The user, date, and ChangeSetID will of course vary.

As we discussed in TutorialClone, the new ChangeSet only exists in this repository. This is a critical part of the way ["Mercurial"] works.

To share changes, we must continue to TutorialShareChange.
----
CategoryGerman
She is known by the name of Merri. Her neighbors say it's not good for her however what she loves doing is to do ceramics however she can't make it her career. She used to be unemployed nevertheless now he is an info officer. Guam is where he's always been living. Her husband plus her maintain a website. We would need to check it out: http://www.shemale6cams.com

She is known by the name of Merri. Her neighbors say it's not good for her however what she loves doing is to do ceramics however she can't make it her career. She used to be unemployed nevertheless now he is an info officer. Guam is where he's always been living. Her husband plus her maintain a website. We would need to check it out: http://www.shemale6cams.com

GermanTutorialFirstChange (last edited 2013-08-27 17:12:43 by AugieFackler)