[Python-Dev] PEP: Collecting information about git

Oleg Broytman phd at phdru.name
Sun Sep 13 04:31:40 CEST 2015


Hi!

On Sun, Sep 13, 2015 at 09:14:58AM +1000, Tim Delaney <timothy.c.delaney at gmail.com> wrote:
> On 13 September 2015 at 04:42, Oleg Broytman <phd at phdru.name> wrote:
> 
> >    There are too many things that I personally can do with git but can't
> > do with hg. Because of that I switched all my development from hg to git
> > and I am willing to help those who want to follow.
> 
> Slightly off-topic, but personally I'd love to know what those are. I've
> yet to find anything in Git that I haven't been able to do at least as well
> with Mercurial (or an extension), and there are things Mercurial
> supports that I use extensively (in particular named branches and phases)
> where the concept doesn't even exist in Git.

   I started to learn Mercurial at the end of 2008 and made the first
commit at January of 2009. Global named branches was one of the
(mis)features that I disliked from the very beginning. One top-level
.hgignore file instead of proper per-directory ignore files. Two-commits
tagging -- the tag is committed in a different commit from the commit it
tags. Repositories to pull from and push to must be related -- they must
be (in)direct clones of one root repo. There were also things that I
wanted but didn't really understand what I wanted -- I switched to
Mercurial from CVS and SVN and didn't fully understand the real power of
distributed VCS.
   I was the only developer of the project, the project was not very
big:
   $ du -sh third-party .hg .
   2.4M  third-party
   2.2M  .hg
   6.2M  .
and didn't require intensive development so instead of named branches
I decided to go with two separate clones, old and new, and use ``hg
transplant`` to copy occasional commits from the old clone to the new
one.

   Somewhere at the end of 2011 my management moved me to a different
project. They use git for development so I started to learn git (i.e.,
Mercurial had 3 years start). I am a slow thinker so it took me about a
year to master git, another year to appreciate it and at the third year
I fell in love with it. The project is much bigger:
   $ du -sh libs/third-party third-party .git .
   24M   libs/third-party
   46M   third-party
   48M   .git
   20M   .
and development is much more intensive -- there are many developers,
many clones, many subprojects, many submodules, third-party libraries
and programs, many branches with merges.
   Git fixed all the problems I had with hg. Its branching model suits
my understanding of branches much better. With git we can have
per-directory .gitignore and .gitattributes. Lightweight and annotated
tags point exactly to the commits they tag. Ability to pull and push
between unrelated repos.
   I learned commit editing and found that it was the thing I wanted so
badly in hg. When I started Mercurial was at version 1.7 and there was
no commit editing at all; there was ``hg rollback`` but it only could
undo one transaction. Later Mercurial learned commit editing,
unwillingly perhaps, but git is still better at it: ``git add -p``
allows me to review and edit patches before commit while ``hg record``
commits immediately.
   Git is powerful. Even now, at version 3.1 ``hg help log`` lists about
a dozen of options; ``git help log`` gives me about 60 pages of
documentation. I do not use all of them but I very much like ``git log
--decorate``, ``--graph``, ``--grep=`` (and all related search options,
especially ``-G``), ``--pretty``, ``--oneline``, ``--encoding=`` (I
often use koi8-r instead of utf-8), ``--color`` and ``--word-diff``. I
like ``git grep``, especially in the form ``git grep -Ovim``. I don't
know what are the equivalent commands for ``git commit -c HEAD~`` or
``git diff --name-only``.
   Git has a lot of good documentation.

   A few months ago I converted those two clones from hg to git using
git-remote-hg, merged them into one repository as branches, did a
null-merge and from that point I have been using proper branches and
merges for development. I stopped using Mercurial and I think I will not
come back.

   As I stopped using Mercurial I do not understand what phases are.
they are phases of commit according to what? To the origin (let me
borrow the word from git terminology)?

   Mercurial, for sure, has some advantages. It is written in Python.
That's important. That's important for ideological reasons. That's also
important because hg runs natively under Windows, it even has code for
working with case-insensitive filesystems.
   There are Mercurial Queues.
   There are also small advantages like better polished command-line
interface and ability to shorten command names and options to a unique
prefix.

> Tim Delaney

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            phd at phdru.name
           Programmers don't die, they just GOSUB without RETURN.


More information about the Python-Dev mailing list