Commit 2372bead authored by paugier's avatar paugier
Browse files

Update Mercurial intro with a new figure

parent 7022b3b5
Pipeline #50740 passed with stage
in 52 seconds
......@@ -35,7 +35,8 @@
"metadata": {},
"source": [
"<div align=\"middle\">\n",
"<img src=\"./fig/git.png\" style=\"width: 30%; margin-top: -30px; margin-bottom: -20px\"> &nbsp;\n",
"<img src=\"./fig/git.png\" style=\"width: 30%; margin-top: -30px; margin-bottom: -10px; margin-right: 20px;\"> &nbsp;\n",
"<img src=\"./fig/schemes_hggit/simple_commands_hg.png\" style=\"width: 30%; margin-top: -30px; margin-bottom: -10px; margin-left: 20px;\">\n",
"</div>"
]
},
......@@ -83,13 +84,17 @@
"source": [
"### Why Gitlab?\n",
"\n",
"https://gricad-gitlab.univ-grenoble-alpes.fr\n",
"- \"GitLab is a web-based DevOps lifecycle tool that provides a Git-repository manager providing wiki, issue-tracking and continuous integration and deployment pipeline features, using an open-source license\" (from https://en.wikipedia.org/wiki/GitLab)\n",
"\n",
"- https://gricad-gitlab.univ-grenoble-alpes.fr\n",
"\n",
"- Used by nice projects like Debian and Gnome\n",
"\n",
"### Warning! Gitlab does not natively support Mercurial!\n",
"\n",
"For now, we'll have to use a Mercurial extension (hg-git) and it won't be as nice as if we could use a platform natively supporting Mercurial (as for example Bitbucket).\n",
"For now, we'll have to use a Mercurial extension (hg-git) and it won't be as nice as if we could use a platform natively supporting Mercurial.\n",
"\n",
"But there is now [Heptapod (Gitlab with Mercurial support)](https://heptapod.net/)."
"However, there is now [Heptapod (Gitlab with Mercurial support)](https://heptapod.net/)."
]
},
{
......@@ -133,14 +138,26 @@
"Change creation:\n",
"\n",
" absorb incorporate corrections into the stack of draft changesets\n",
" amend combine a changeset with updates and replace it with a new one\n",
" commit commit the specified files or all outstanding changes\n",
"\n",
"Change manipulation:\n",
"\n",
" backout reverse effect of earlier changeset\n",
" evolve solve troubled changesets in your repository\n",
" fold fold multiple revisions into a single one\n",
" graft copy changes from other branches onto the current branch\n",
" merge merge another revision into working directory\n",
" metaedit edit commit information\n",
" pick move a commit on the top of working directory parent and\n",
" updates to it.\n",
" prune mark changesets as obsolete or succeeded by another changeset\n",
" rebase move changeset (and descendants) to a different branch\n",
" rewind rewind a stack of changesets to a previous state\n",
" split split a changeset into smaller changesets\n",
" touch create successors identical to their predecessors but the\n",
" changeset ID\n",
" uncommit move changes from parent revision to working directory\n",
"\n",
"Change organization:\n",
"\n",
......@@ -150,6 +167,8 @@
" phase set or show the current phase name\n",
" tag add one or more tags for the current or given revision\n",
" tags list repository tags\n",
" topics View current topic, set current topic, change topic for a set\n",
" of revisions, or see all topics.\n",
"\n",
"File content management:\n",
"\n",
......@@ -158,7 +177,7 @@
" copy mark files as copied for the next commit\n",
" diff diff repository (or selected files)\n",
" extdiff use external program to diff repository (or selected files)\n",
" grep search revision history for a pattern in specified files\n",
" grep search for a pattern in specified files\n",
" meld use external program to diff repository (or selected files)\n",
"\n",
"Change navigation:\n",
......@@ -167,6 +186,8 @@
" heads show branch heads\n",
" identify identify the working directory or specified revision\n",
" log show revision history of entire repository or files\n",
" obslog show the obsolescence history of the specified revisions\n",
" stack list all changesets in a topic and other information\n",
"\n",
"Working directory management:\n",
"\n",
......@@ -174,6 +195,10 @@
" addremove add all new files, delete all missing files\n",
" files list tracked files\n",
" forget forget the specified files on the next commit\n",
" next update to next child revision\n",
" pdiff show diff combining committed and uncommited changes\n",
" previous update to parent revision\n",
" pstatus show status combining committed and uncommited changes\n",
" remove remove the specified files on the next commit\n",
" rename rename files; equivalent of copy + remove\n",
" resolve redo merges or set/view the merge status of files\n",
......@@ -208,40 +233,20 @@
"\n",
"Uncategorized commands:\n",
"\n",
" amend combine a changeset with updates and replace it with a new one\n",
" evolve solve troubled changesets in your repository\n",
" fold fold multiple revisions into a single one\n",
" gclear clear out the Git cached data\n",
" gexport export commits from Mercurial to Git\n",
" gimport import commits from Git to Mercurial\n",
" git-cleanup clean up Git commit map after history editing\n",
" gverify verify that a Mercurial rev matches the corresponding Git rev\n",
" metaedit edit commit information\n",
" next update to next child revision\n",
" obslog show the obsolescence history of the specified revisions\n",
" pdiff show diff combining committed and uncommited changes\n",
" pick move a commit on the top of working directory parent and\n",
" updates to it.\n",
" previous update to parent revision\n",
" prune mark changesets as obsolete or succeeded by another changeset\n",
" pstatus show status combining committed and uncommited changes\n",
" rewind rewind a stack of changesets to a previous state\n",
" split split a changeset into smaller changesets\n",
" stack list all changesets in a topic and other information\n",
" topics View current topic, set current topic, change topic for a set\n",
" of revisions, or see all topics.\n",
" touch create successors identical to their predecessors but the\n",
" changeset ID\n",
" uncommit move changes from parent revision to working directory\n",
"\n",
"enabled extensions:\n",
"\n",
" churn command to display statistics about repository history\n",
" evolve extends Mercurial feature related to Changeset Evolution\n",
" extdiff command to allow external programs to compare revisions\n",
" hgfluiddyn\n",
" hggit push and pull from a Git server\n",
" rebase command to move sets of revisions to a different ancestor\n",
" shelve save and restore changes to the working directory\n",
" topic support for topic branches\n",
"\n",
"additional help topics:\n",
......@@ -274,6 +279,7 @@
"Concepts:\n",
"\n",
" bundlespec Bundle File Formats\n",
" evolution Safely Rewriting History\n",
" glossary Glossary\n",
" phases Working with Phases\n",
" subrepos Subrepositories\n",
......@@ -286,7 +292,6 @@
"\n",
"Uncategorized topics:\n",
"\n",
" evolution Safely Rewriting History\n",
" git Working with Git Repositories\n",
"\n",
"(use 'hg help -v' to show built-in aliases and global options)\n"
......@@ -343,7 +348,23 @@
}
},
"source": [
"## Level 0: commands `init`, `status`, `add`, `remove`, `addremove`, `commit`, `log` and `summary`"
"## Level 0: one local repository"
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"<div align=\"middle\">\n",
"<img src=\"./fig/schemes_hggit/simple_commands_hg.png\" style=\"width: 30%; margin-top: -0px; margin-bottom: -10px; margin-left: 20px;\">\n",
"</div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Commands `init`, `status`, `add`, `remove`, `addremove`, `commit`, `log` and `summary`"
]
},
{
......@@ -356,6 +377,13 @@
"rm -rf /tmp/myrepos"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's create a directory and a file in it."
]
},
{
"cell_type": "code",
"execution_count": 4,
......@@ -367,6 +395,13 @@
"touch file0.txt"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's tell Mercurial that we want to make a new repository from this directory."
]
},
{
"cell_type": "code",
"execution_count": 5,
......@@ -376,6 +411,13 @@
"hg init"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's ask Mercurial what is new in this repository."
]
},
{
"cell_type": "code",
"execution_count": 6,
......@@ -411,6 +453,13 @@
"hg st"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We want to \"Schedule files to be version controlled and added to the repository.\""
]
},
{
"cell_type": "code",
"execution_count": 8,
......@@ -428,6 +477,13 @@
"hg add"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A new `status` gives"
]
},
{
"cell_type": "code",
"execution_count": 9,
......@@ -445,6 +501,13 @@
"hg st"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's now create the first commit (or \"changeset\"). We can think about it as a snapshot of the code as it is now."
]
},
{
"cell_type": "code",
"execution_count": 10,
......@@ -454,6 +517,13 @@
"hg commit -m \"First commit\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A new `status` returns nothing because there is nothing new from the last commit."
]
},
{
"cell_type": "code",
"execution_count": 11,
......@@ -463,6 +533,13 @@
"hg st"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's add a new file:"
]
},
{
"cell_type": "code",
"execution_count": 12,
......@@ -516,6 +593,13 @@
"hg st"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"One new file and one file removed from the working directory. We want to take a new snapshot of the code how it is now. `addremove` is very useful is that common situation."
]
},
{
"cell_type": "code",
"execution_count": 16,
......@@ -649,6 +733,13 @@
"hg st"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We used a lot `status` to get information about the state of the repository. Let's discover 2 other very useful commands: `sum` (or `summary`) and `log`."
]
},
{
"cell_type": "code",
"execution_count": 25,
......@@ -658,7 +749,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0;33mparent: 2:f64ab784311c \u001b[0mtip\n",
"\u001b[0;33mparent: 2:035898fd5135 \u001b[0mtip\n",
" Hello world in file1.txt\n",
"branch: default\n",
"commit: (clean)\n",
......@@ -687,20 +778,20 @@
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0;33mchangeset: 2:f64ab784311c\u001b[0m\n",
"\u001b[0;33mchangeset: 2:035898fd5135\u001b[0m\n",
"tag: tip\n",
"user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"date: Fri Jun 14 23:20:17 2019 +0200\n",
"date: Tue Oct 13 11:09:54 2020 +0200\n",
"summary: Hello world in file1.txt\n",
"\n",
"\u001b[0;33mchangeset: 1:ebb8c645f614\u001b[0m\n",
"\u001b[0;33mchangeset: 1:92c129924737\u001b[0m\n",
"user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"date: Fri Jun 14 23:20:16 2019 +0200\n",
"date: Tue Oct 13 11:09:53 2020 +0200\n",
"summary: Remove file0 and add file1\n",
"\n",
"\u001b[0;33mchangeset: 0:29f68d89d843\u001b[0m\n",
"\u001b[0;33mchangeset: 0:dedcc4a8b21e\u001b[0m\n",
"user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"date: Fri Jun 14 23:20:14 2019 +0200\n",
"date: Tue Oct 13 11:09:51 2020 +0200\n",
"summary: First commit\n",
"\n"
]
......@@ -719,20 +810,20 @@
"name": "stdout",
"output_type": "stream",
"text": [
"@ \u001b[0;33mchangeset: 2:f64ab784311c\u001b[0m\n",
"@ \u001b[0;33mchangeset: 2:035898fd5135\u001b[0m\n",
"| tag: tip\n",
"| user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"| date: Fri Jun 14 23:20:17 2019 +0200\n",
"| date: Tue Oct 13 11:09:54 2020 +0200\n",
"| summary: Hello world in file1.txt\n",
"|\n",
"o \u001b[0;33mchangeset: 1:ebb8c645f614\u001b[0m\n",
"o \u001b[0;33mchangeset: 1:92c129924737\u001b[0m\n",
"| user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"| date: Fri Jun 14 23:20:16 2019 +0200\n",
"| date: Tue Oct 13 11:09:53 2020 +0200\n",
"| summary: Remove file0 and add file1\n",
"|\n",
"o \u001b[0;33mchangeset: 0:29f68d89d843\u001b[0m\n",
"o \u001b[0;33mchangeset: 0:dedcc4a8b21e\u001b[0m\n",
" user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
" date: Fri Jun 14 23:20:14 2019 +0200\n",
" date: Tue Oct 13 11:09:51 2020 +0200\n",
" summary: First commit\n",
"\n"
]
......@@ -751,20 +842,20 @@
"name": "stdout",
"output_type": "stream",
"text": [
"@ \u001b[0;33mchangeset: 2:f64ab784311c\u001b[0m\n",
"@ \u001b[0;33mchangeset: 2:035898fd5135\u001b[0m\n",
"| tag: tip\n",
"| user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"| date: Fri Jun 14 23:20:17 2019 +0200\n",
"| date: Tue Oct 13 11:09:54 2020 +0200\n",
"| summary: Hello world in file1.txt\n",
"|\n",
"o \u001b[0;33mchangeset: 1:ebb8c645f614\u001b[0m\n",
"o \u001b[0;33mchangeset: 1:92c129924737\u001b[0m\n",
"| user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"| date: Fri Jun 14 23:20:16 2019 +0200\n",
"| date: Tue Oct 13 11:09:53 2020 +0200\n",
"| summary: Remove file0 and add file1\n",
"|\n",
"o \u001b[0;33mchangeset: 0:29f68d89d843\u001b[0m\n",
"o \u001b[0;33mchangeset: 0:dedcc4a8b21e\u001b[0m\n",
" user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
" date: Fri Jun 14 23:20:14 2019 +0200\n",
" date: Tue Oct 13 11:09:51 2020 +0200\n",
" summary: First commit\n",
"\n"
]
......@@ -902,20 +993,20 @@
"name": "stdout",
"output_type": "stream",
"text": [
"@ \u001b[0;33mchangeset: 2:f64ab784311c\u001b[0m\n",
"@ \u001b[0;33mchangeset: 2:035898fd5135\u001b[0m\n",
"| tag: tip\n",
"| user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"| date: Fri Jun 14 23:20:17 2019 +0200\n",
"| date: Tue Oct 13 11:09:54 2020 +0200\n",
"| summary: Hello world in file1.txt\n",
"|\n",
"o \u001b[0;33mchangeset: 1:ebb8c645f614\u001b[0m\n",
"o \u001b[0;33mchangeset: 1:92c129924737\u001b[0m\n",
"| user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"| date: Fri Jun 14 23:20:16 2019 +0200\n",
"| date: Tue Oct 13 11:09:53 2020 +0200\n",
"| summary: Remove file0 and add file1\n",
"|\n",
"o \u001b[0;33mchangeset: 0:29f68d89d843\u001b[0m\n",
"o \u001b[0;33mchangeset: 0:dedcc4a8b21e\u001b[0m\n",
" user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
" date: Fri Jun 14 23:20:14 2019 +0200\n",
" date: Tue Oct 13 11:09:51 2020 +0200\n",
" summary: First commit\n",
"\n"
]
......@@ -952,7 +1043,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0;33mparent: 0:29f68d89d843 \u001b[0m\n",
"\u001b[0;33mparent: 0:dedcc4a8b21e \u001b[0m\n",
" First commit\n",
"branch: default\n",
"commit: (clean)\n",
......@@ -1042,26 +1133,26 @@
"name": "stdout",
"output_type": "stream",
"text": [
"@ \u001b[0;33mchangeset: 3:674ce551f5c4\u001b[0m\n",
"@ \u001b[0;33mchangeset: 3:646d6c11e837\u001b[0m\n",
"| tag: tip\n",
"| parent: 0:29f68d89d843\n",
"| parent: 0:dedcc4a8b21e\n",
"| user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"| date: Fri Jun 14 23:20:21 2019 +0200\n",
"| date: Tue Oct 13 11:09:58 2020 +0200\n",
"| summary: A line in file0.txt\n",
"|\n",
"| o \u001b[0;33mchangeset: 2:f64ab784311c\u001b[0m\n",
"| o \u001b[0;33mchangeset: 2:035898fd5135\u001b[0m\n",
"| | user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"| | date: Fri Jun 14 23:20:17 2019 +0200\n",
"| | date: Tue Oct 13 11:09:54 2020 +0200\n",
"| | summary: Hello world in file1.txt\n",
"| |\n",
"| o \u001b[0;33mchangeset: 1:ebb8c645f614\u001b[0m\n",
"| o \u001b[0;33mchangeset: 1:92c129924737\u001b[0m\n",
"|/ user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"| date: Fri Jun 14 23:20:16 2019 +0200\n",
"| date: Tue Oct 13 11:09:53 2020 +0200\n",
"| summary: Remove file0 and add file1\n",
"|\n",
"o \u001b[0;33mchangeset: 0:29f68d89d843\u001b[0m\n",
"o \u001b[0;33mchangeset: 0:dedcc4a8b21e\u001b[0m\n",
" user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
" date: Fri Jun 14 23:20:14 2019 +0200\n",
" date: Tue Oct 13 11:09:51 2020 +0200\n",
" summary: First commit\n",
"\n"
]
......@@ -1097,7 +1188,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0;33mparent: 1:ebb8c645f614 \u001b[0m\n",
"\u001b[0;33mparent: 1:92c129924737 \u001b[0m\n",
" Remove file0 and add file1\n",
"branch: default\n",
"commit: (clean)\n",
......@@ -1120,7 +1211,7 @@
"output_type": "stream",
"text": [
"1 files updated, 0 files merged, 0 files removed, 0 files unresolved\n",
"updated to \"f64ab784311c: Hello world in file1.txt\"\n",
"updated to \"035898fd5135: Hello world in file1.txt\"\n",
"1 other heads for branch \"default\"\n"
]
}
......@@ -1138,7 +1229,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0;33mparent: 2:f64ab784311c \u001b[0m\n",
"\u001b[0;33mparent: 2:035898fd5135 \u001b[0m\n",
" Hello world in file1.txt\n",
"branch: default\n",
"commit: (clean)\n",
......@@ -1229,32 +1320,32 @@
"name": "stdout",
"output_type": "stream",
"text": [
"@ \u001b[0;33mchangeset: 4:5f1ccf526f78\u001b[0m\n",
"@ \u001b[0;33mchangeset: 4:bd50bdf1febc\u001b[0m\n",
"| tag: tip\n",
"| parent: 2:f64ab784311c\n",
"| parent: 2:035898fd5135\n",
"| user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"| date: Fri Jun 14 23:20:23 2019 +0200\n",
"| date: Tue Oct 13 11:10:00 2020 +0200\n",
"| summary: Add file 2\n",
"|\n",
"| o \u001b[0;33mchangeset: 3:674ce551f5c4\u001b[0m\n",
"| | parent: 0:29f68d89d843\n",
"| o \u001b[0;33mchangeset: 3:646d6c11e837\u001b[0m\n",
"| | parent: 0:dedcc4a8b21e\n",
"| | user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"| | date: Fri Jun 14 23:20:21 2019 +0200\n",
"| | date: Tue Oct 13 11:09:58 2020 +0200\n",
"| | summary: A line in file0.txt\n",
"| |\n",
"o | \u001b[0;33mchangeset: 2:f64ab784311c\u001b[0m\n",
"o | \u001b[0;33mchangeset: 2:035898fd5135\u001b[0m\n",
"| | user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"| | date: Fri Jun 14 23:20:17 2019 +0200\n",
"| | date: Tue Oct 13 11:09:54 2020 +0200\n",
"| | summary: Hello world in file1.txt\n",
"| |\n",
"o | \u001b[0;33mchangeset: 1:ebb8c645f614\u001b[0m\n",
"o | \u001b[0;33mchangeset: 1:92c129924737\u001b[0m\n",
"|/ user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"| date: Fri Jun 14 23:20:16 2019 +0200\n",
"| date: Tue Oct 13 11:09:53 2020 +0200\n",
"| summary: Remove file0 and add file1\n",
"|\n",
"o \u001b[0;33mchangeset: 0:29f68d89d843\u001b[0m\n",
"o \u001b[0;33mchangeset: 0:dedcc4a8b21e\u001b[0m\n",
" user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
" date: Fri Jun 14 23:20:14 2019 +0200\n",
" date: Tue Oct 13 11:09:51 2020 +0200\n",
" summary: First commit\n",
"\n"
]
......@@ -1297,26 +1388,26 @@
"name": "stdout",
"output_type": "stream",
"text": [
"@ \u001b[0;33mchangeset: 4:5f1ccf526f78\u001b[0m\n",
"@ \u001b[0;33mchangeset: 4:bd50bdf1febc\u001b[0m\n",
"| tag: tip\n",
"| parent: 2:f64ab784311c\n",
"| parent: 2:035898fd5135\n",
"| user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"| date: Fri Jun 14 23:20:23 2019 +0200\n",
"| date: Tue Oct 13 11:10:00 2020 +0200\n",
"| summary: Add file 2\n",
"|\n",
"o \u001b[0;33mchangeset: 2:f64ab784311c\u001b[0m\n",
"o \u001b[0;33mchangeset: 2:035898fd5135\u001b[0m\n",
"| user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"| date: Fri Jun 14 23:20:17 2019 +0200\n",
"| date: Tue Oct 13 11:09:54 2020 +0200\n",
"| summary: Hello world in file1.txt\n",
"|\n",
"o \u001b[0;33mchangeset: 1:ebb8c645f614\u001b[0m\n",
"o \u001b[0;33mchangeset: 1:92c129924737\u001b[0m\n",
"| user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
"| date: Fri Jun 14 23:20:16 2019 +0200\n",
"| date: Tue Oct 13 11:09:53 2020 +0200\n",
"| summary: Remove file0 and add file1\n",
"|\n",
"o \u001b[0;33mchangeset: 0:29f68d89d843\u001b[0m\n",
"o \u001b[0;33mchangeset: 0:dedcc4a8b21e\u001b[0m\n",
" user: paugier <pierre.augier@univ-grenoble-alpes.fr>\n",
" date: Fri Jun 14 23:20:14 2019 +0200\n",
" date: Tue Oct 13 11:09:51 2020 +0200\n",
" summary: First commit\n",
"\n"
]
......@@ -1334,7 +1425,37 @@
}
},
"source": [
"## Level 2: commands `clone`, `push`, `pull` "
"## Level 2: working with a remote repository (usually on the web)"
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"<div align=\"middle\">\n",
"<img src=\"./fig/schemes_hggit/simple_commands_hg.png\" style=\"width: 30%; margin-top: -0px; margin-bottom: -10px; margin-left: 20px;\">\n",
"</div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Commands `clone`, `push`, `pull`\n",
"\n",
"The most standard way to create a local repository is to clone a remote repository available on the web. This is done with the command `clone` like this:\n",
"\n",
"```bash\n",
"hg clone ssh://hg@foss.heptapod.net/fluiddyn/fluidsim\n",
"```\n",
"\n",
"Here, I used ssh, which is usually more convenient than https, but one can also use http addresses like `https://github.com/hpyproject/hpy.git`. On Github, Gitlab, Heptapod, there is usually a blue button `Code` or `Clone` from which one can get the right address to clone a repository. \n",
"\n",
"Warning: sometimes, the addresses are not exactly like the web address, for example `git@github.com:hpyproject/hpy.git`.\n",
"\n",
"Note: with the extension `hg_git`, one can work on remote Git repositories with a local Mercurial repository (more on that later).\n",
"\n",
"For this tutorial, we will create a local \"web\" repository."
]
},
{
......@@ -1370,7 +1491,7 @@
"adding file changes\n",
"added 4 changesets with 4 changes to 3 files\n",
"1 new obsolescence markers\n",
"new changesets 29f68d89d843:5f1ccf526f78\n",
"new changesets dedcc4a8b21e:bd50bdf1febc\n",
"updating to branch default\n",
"2 files updated, 0 files merged, 0 files removed, 0 files unresolved\n"
]
......@@ -1380,19 +1501,44 @@
"hg clone myrepo0 myrepo_web"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now, we have a \"web\" repository that we can use as if it was on the web. Let's first clone it."
]
},
{
"cell_type": "code",
"execution_count": 58,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"updating to branch default\n",
"2 files updated, 0 files merged, 0 files removed, 0 files unresolved\n"
]
}
],
"source": [
"cd myrepo0"