From: Matt Mackall <mpm@selenic.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
Git Mailing List <git@vger.kernel.org>,
mercurial@selenic.com
Subject: Mercurial vs Updated git HOWTO for kernel hackers
Date: Thu, 23 Jun 2005 16:56:34 -0700 [thread overview]
Message-ID: <20050623235634.GC14426@waste.org> (raw)
In-Reply-To: <42B9E536.60704@pobox.com>
On Wed, Jun 22, 2005 at 06:24:54PM -0400, Jeff Garzik wrote:
>
> Things in git-land are moving at lightning speed, and usability has
> improved a lot since my post a month ago: http://lkml.org/lkml/2005/5/26/11
And here's a quick comparison with the current state of Mercurial..
> 1) installing git
>
> git requires bootstrapping, since you must have git installed in order
> to check out git.git (git repo), and linux-2.6.git (kernel repo). I
> have put together a bootstrap tarball of today's git repository.
>
> Download tarball from:
> http://www.kernel.org/pub/linux/kernel/people/jgarzik/git-20050622.tar.bz2
>
> tarball build-deps: zlib, libcurl, libcrypto (openssl)
>
> install tarball: unpack && make && sudo make prefix=/usr/local install
>
> jgarzik helper scripts, not in official git distribution:
> http://www.kernel.org/pub/linux/kernel/people/jgarzik/git-new-branch
> http://www.kernel.org/pub/linux/kernel/people/jgarzik/git-changes-script
>
> After reading the rest of this document, come back and update your copy
> of git to the latest:
> rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/git.git
Download from: http://selenic.com/mercurial/mercurial-snapshot.tar.gz
Build-deps: Python 2.3
Install: unpack && python setup.py install [--home=/usr/local]
> 2) download a linux kernel tree for the very first time
>
> $ mkdir -p linux-2.6/.git
> $ cd linux-2.6
> $ rsync -a --delete --verbose --stats --progress \
> rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git/
> \ <- word-wrapped backslash; sigh
> .git/
$ mkdir linux-2.6
$ cd linux-2.6
$ hg init http://www.kernel.org/hg/ # obviously you can also browse this
This downloads about 125M of data, which include the whole kernel history
back to 2.4.0 and everything in Linus' git repo as well.
> 3) update local kernel tree to latest 2.6.x upstream ("fast-forward merge")
>
> $ cd linux-2.6
> $ git-pull-script \
> rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
$ hg pull # defaults to where you originally pulled from
It takes about 4M of transfer and well under a minute to pull the
entire git history, starting from a base of 2.6.12-rc2.
> 4) check out files from the git repository into the working directory
>
> $ git checkout -f
$ hg update # or up or checkout or co, depending on your SCM habits
> 5) check in your own modifications (e.g. do some hacking, or apply a patch)
>
> # go to repo
> $ cd linux-2.6
>
> # make some modifications
> $ patch -sp1 < /tmp/my.patch
> $ diffstat -p1 < /tmp/my.patch
>
> # NOTE: add '--add' and/or '--remove' if files were added or removed
> $ git-update-cache <list of all files changed>
>
> # check in changes
> $ git commit
$ hg commit [files] # check in everything changed or just the named files
5.1) undo the last commit or pull
$ hg undo
> 6) List all changes in working dir, in diff format.
>
> $ git-diff-cache -p HEAD
$ hg status # show changed files
> 7) List all changesets (i.e. show each cset's description text) in local
> branch of local tree, that are not present in remote tree.
>
> $ cd my-kernel-tree-2.6
> $ git-changes-script -L ../linux-2.6 | less
$ hg history | less # How does git know what's not in the
# remote tree? Psychic?
> 8) List all changesets:
>
> $ git-whatchanged
$ hg history | less
> 9) apply all patches in a Berkeley mbox-format file
>
> First, download and add to your PATH Linus's git tools:
> rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/git-tools.git
>
> $ cd my-kernel-tree-2.6
> $ dotest /path/to/mbox # yes, Linus has no taste in naming scripts
hg doesn't do mboxes directly, but you can do:
$ cat patch-list | xargs hg import
> 10) don't forget to download tags from time to time.
>
> git-pull-script only downloads sha1-indexed object data, and the
> requested remote head. This misses updates to the .git/refs/tags/ and
> .git/refs/heads directories. It is advisable to update your kernel .git
> directories periodically with a full rsync command, to make sure you got
> everything:
>
> $ cd linux-2.6
> $ rsync -a --delete --verbose --stats --progress \
> rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git/
> \ <- word-wrapped backslash; sigh
> .git/
Tags in mercurial are properly version controlled and come along for
the ride with pulls. Also, the right thing happens with merges.
> 11) list all branches, such as those found in my netdev-2.6 or
> libata-dev trees.
>
> Download
> rsync://rsync.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
> or
> rsync://rsync.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git
>
>
> $ cd netdev-2.6
> $ ls .git/refs/heads/
>
> { these are the current netdev-2.6 branches }
> >8139cp forcedeth master qeth smc91x we18
> >8139too-iomap for-linus natsemi r8169 smc91x-eeprom wifi
> >airo hdlc ns83820 register-netdev starfire
> >atmel ieee80211 orinoco remove-drivers tlan
> >chelsio iff-running orinoco-hch sis900 veth
> >dm9000 janitor ppp skge viro
$ hg heads # Has Andrew mentioned your git forest gives him a headache?
> 12) make desired branch current in working directory
>
> $ git checkout -f $branch
$ hg update -C <rev or id or tag>
> 13) create a new branch, and make it current
>
> $ cp .git/refs/heads/master .git/refs/heads/my-new-branch-name
> $ git checkout -f my-new-branch-name
Since the hg repo is lightweight, this is usually done by just having
different directories. Thus we don't explicitly name branches.
$ mkdir new-branch
$ cd new-branch
$ hg init -u ../linux # makes hardlinks and does a checkout
> 14) examine which branch is current
>
> $ ls -l .git/HEAD
$ echo $PWD
> 15) undo all local modifications (same as checkout):
>
> $ git checkout -f
$ hg update -C
> 16) obtain a diff between current branch, and master branch
>
> In most trees WITH BRANCHES, .git/refs/heads/master contains the current
> 'vanilla' upstream tree, for easy diffing and merging. (in trees
> without branches, 'master' simply contains your latest changes)
>
> $ git-diff-tree -p master HEAD
$ hg diff -r <rev> -r <rev>
17) run a browsable, pullable repo server of the current repo on your
local machine
$ hg serve
18) push your changes to a remote server
$ hg push ssh://user@host/path/ # aliases and defaults in .hgrc
19) get per-file history
$ hg log <file> | less
20) get annotated file contents
$ hg annotate [file]
21) record that a file has been copied or renamed for the next commit
$ hg copy <source> <dest>
22) get online help
$ hg help [command]
More info at http://selenic.com/mercurial/
--
Mathematics is the supreme nostalgia of our time.
next prev parent reply other threads:[~2005-06-23 23:54 UTC|newest]
Thread overview: 98+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-22 22:24 Updated git HOWTO for kernel hackers Jeff Garzik
2005-06-22 22:40 ` Dave Jones
2005-06-22 22:47 ` Jeff Garzik
2005-06-22 22:52 ` Dave Jones
2005-06-23 0:14 ` Jeff Garzik
2005-06-25 3:33 ` Jeff Garzik
2005-06-25 17:29 ` Dave Jones
2005-06-22 23:09 ` Greg KH
2005-06-22 23:25 ` Linus Torvalds
2005-06-23 0:05 ` Jeff Garzik
2005-06-23 0:29 ` Linus Torvalds
2005-06-23 1:47 ` Jeff Garzik
2005-06-23 1:56 ` Linus Torvalds
2005-06-23 2:16 ` Jeff Garzik
2005-06-23 2:39 ` Linus Torvalds
2005-06-23 3:06 ` Jeff Garzik
2005-06-23 3:24 ` Linus Torvalds
2005-06-23 5:16 ` Jeff Garzik
2005-06-23 5:58 ` Linus Torvalds
2005-06-23 6:20 ` Greg KH
2005-06-23 6:51 ` Linus Torvalds
2005-06-23 7:11 ` Greg KH
2005-06-23 7:03 ` Jeff Garzik
2005-06-23 7:38 ` Petr Baudis
2005-06-23 8:18 ` Martin Langhoff
2005-06-23 8:30 ` Vojtech Pavlik
2005-06-23 14:31 ` Horst von Brand
2005-06-22 23:16 ` Linus Torvalds
2005-06-23 0:15 ` Jeff Garzik
2005-06-23 1:53 ` Linus Torvalds
2005-06-23 7:06 ` Jeff Garzik
2005-06-23 15:29 ` Linus Torvalds
2005-06-23 0:33 ` Linus Torvalds
2005-06-23 2:04 ` Jeff Garzik
2005-06-23 2:28 ` Linus Torvalds
2005-06-23 3:52 ` Adam Kropelin
2005-06-23 4:54 ` Linus Torvalds
2005-06-23 5:35 ` Jeff Garzik
2005-06-23 6:37 ` Linus Torvalds
2005-06-23 6:07 ` Miles Bader
2005-06-23 7:15 ` Jeff Garzik
2005-06-23 16:06 ` Linus Torvalds
2005-06-23 8:01 ` Anton Altaparmakov
2005-06-23 4:23 ` Daniel Barkalow
2005-06-23 12:25 ` Dave Airlie
2005-06-23 23:56 ` Matt Mackall [this message]
2005-06-24 6:41 ` Mercurial vs " Petr Baudis
2005-06-24 12:38 ` Christopher Li
2005-06-28 15:00 ` Petr Baudis
2005-06-28 15:10 ` Andrew Thompson
2005-06-28 15:35 ` Petr Baudis
2005-06-28 21:54 ` Horst von Brand
2005-06-28 18:47 ` Christopher Li
2005-06-29 0:12 ` Kyle Moffett
2005-06-28 18:01 ` Matt Mackall
2005-06-28 20:27 ` Kyle Moffett
2005-06-28 20:45 ` Sean
2005-06-28 22:14 ` Matt Mackall
2005-06-28 22:23 ` Sean
2005-06-28 22:47 ` Kyle Moffett
2005-06-28 22:49 ` Matt Mackall
2005-06-28 22:59 ` Sean
2005-06-28 23:25 ` Kyle Moffett
2005-06-28 23:37 ` Sean
2005-06-29 0:08 ` Kyle Moffett
2005-06-29 0:25 ` Sean
2005-06-29 3:53 ` Kyle Moffett
2005-06-29 10:27 ` Vojtech Pavlik
2005-06-28 23:29 ` Matt Mackall
2005-06-29 6:32 ` Thomas Arendsen Hein
2005-06-24 13:06 ` Andrea Arcangeli
2005-06-24 13:39 ` Theodore Ts'o
2005-06-24 13:46 ` Paolo Ciarrocchi
2005-06-24 12:19 ` Christopher Li
2005-06-24 13:57 ` Kevin Smith
2005-06-24 18:03 ` Matt Mackall
2005-06-28 15:07 ` Petr Baudis
2005-06-28 15:15 ` Sven Verdoolaege
2005-06-28 15:34 ` Petr Baudis
2005-06-28 16:50 ` Cygwin and Native MS Windows (was: Mercurial vs Updated git HOWTO for kernel hackers) Kevin Smith
2005-06-28 16:51 ` Cogito vs. Git " Kevin Smith
2005-06-28 20:54 ` Petr Baudis
2005-06-24 13:16 ` Mercurial vs Updated git HOWTO for kernel hackers Matthias Urlichs
2005-06-24 19:00 ` Linus Torvalds
2005-06-24 19:25 ` John W. Linville
2005-06-24 22:38 ` Jeff Garzik
2005-06-24 21:11 ` Daniel Barkalow
2005-06-24 22:08 ` Should "git-read-tree -m -u" delete files? Junio C Hamano
2005-06-24 22:45 ` Mercurial vs Updated git HOWTO for kernel hackers Joel Becker
2005-06-24 23:08 ` Kyle Moffett
2005-06-27 18:31 ` Pavel Machek
2005-06-27 19:05 ` Kyle Moffett
2005-06-27 19:40 ` Matt Mackall
2005-06-27 19:51 ` Benjamin LaHaise
2005-06-27 20:51 ` Matt Mackall
2005-06-27 21:53 ` Ed Tomlinson
2005-07-08 15:18 ` Amin Azez
2005-07-11 8:56 ` Amin Azez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050623235634.GC14426@waste.org \
--to=mpm@selenic.com \
--cc=git@vger.kernel.org \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mercurial@selenic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).