Python now uses Mercurial
hg.python.org
hg.python.org
http://mail.python.org/pipermail/python-dev/2009-March/08793...
But I see from http://www.python.org/dev/peps/pep-0385/ that it's taken that long to migrate away from svn.
I decided to choose Mercurial as the VCS for my 'work'. This was a team that had no prior exposure to VC before. And works in a mixed environment. Hg follows the 'one true way' philosophy of Python; so there's just a single command to learn for each task. Plus, Bitbucket's new Free pricing plan for tiny teams convinced me to go with it for online hosting(rather than roll our own hg server over vpn)
Though, If I had to choose a host/vcs for 'my awesome FOSS community project', it would go on Github.
I often hear people claiming hg is easier to use and has a better interface, but every time I have to use hg it rubs me the wrong way because I can't use it like I use git :/ (In particular, I find hg branches needlessly complicated and cumbersome compared to git's "just a pointer" model)
I guess between the two you'll end up using the one you first bother to learn beyond memorising basic commands.
Git has had two main drawbacks in my mind. 1) Much of it is implemented as script commands, and I think it still requires you run an emulated shell in Windows to use it (by contrast, Mercurial is a pure python app, and is ultra-portable). 2) Coming from the Linux community, it seems a little heavy weight for small projects. Some command require what seem like extra steps on Git as compared to Hg. For example, Git requires that you do a "git add" before doing a "git commit". Mercurial assumes that you want to add all the changed files in your repo (or you can list the files needed in a commit).
For complex scenarios, Git's system does provide a bit more control in packaging up exactly the set of changes you want in each atomic revision.
Besides these minor historical differences, I think they both are excellent, and are really a matter of personal or team preference.
git add just adds the file to the index and stages it for commit, this means you can group files logically depending on what has changed, you can even using git add -p have only certain parts of a files modifications be committed and the rest be staged for the next commit. This can be very powerful.
For example, if I did a full refactoring of a class, and fixed a quick bug rather than committing them both at the same time in the patch I can just keep the bug fix and then later commit the re-factored code even if it is in the same file.
Once you get used to having the ability to create arbitrary commits from a huge changeset, you'll find it aggravating when everyone else commits "3 bug fixes to core, swapping out a style sheet, and cleanup in database code" :)
aka push -f and yell at them.
This is one of the features of git I most appreciated when I started using it (my first VCS was Mercurial).
I get distracted easily. While I'm rooting through the code base trying to do something, I'll notice something else to fix. And something else. And something else. By the time I've finished whatever I was trying to do in the first place, I've got 5 or 6 different things I've actually done.
In git, it's trivial to split these up - `git add` separate files, or `git add -p` when you only want to stage some of the changes in a file. This leads to cleaner commits.
I've heard people decry this, saying that you should be testing each individual state of your codebase. git being the powerful sonuvabitch it is, you can do that:
* `git stash --keep-index` will store away all of your modifications, other than the ones you're getting ready to commit. Run your tests, commit, `git stash pop`. * Checking out different revisions and running tests isn't a bad option, either, whether you use `git bisect` or do it manually. With the amazing power of `git rebase -i`[0], you can easily fix any little issues without disrupting other commits.
[0]: http://schacon.github.com/history.html
You will change their SHA1 sums, so they'll become different commits. This isn't a problem, though, if you haven't pushed them up to a shared repository.
Compare: `git branch xxx / git branch -a`, `git tag xxx / git tag -l`, `git show-ref --heads`
To: `hg branch xxx / hg branches`, `hg tag xxx / hg tags`, `hg heads`
There are also "duplicates" that I'm not sure why aren't folded into one command: `show-branch/branch`, `show xxx` which is `diff -c xxx` in many other systems, etc.
These are just simple cases, but there's loads of situations where you have to find out yet another command in git / yet another parameter to do what you want. Hg has better defined defaults and the whole list of commands looks like it was designed, while git looks like everyone just added what they needed... Auto-expanding commands in hg is also nice - I hate it when git tells me 'ci' or other short name is not a command (yeah, I know about aliases).
In some situations I also think that git does exactly what it's programmed to do... which isn't always the same as - what workflow makes sense in a specific case. For example `branch` creates a branch, but you still need to do `checkout` (or just `checkout -b ...`). Why? What's the common use case for creating a branch you're not going to work on? Which behaviour do you expect more often?
All in all, not the end of the world, but when you use the tool every day, it becomes annoying, especially if you see it can be done better.
`show xxx` which is `diff -c xxx`
There is a subtle difference. git-show is meant to show an object. A commit is an object, but so are other things. A more descriptive name would be 'git show-object.' git show <branch_name>:<filename>
This will show you the contents of <filename> on <branch_name>. It does not show you the diff of that file for the latest commit to <branch_name>; it spits out the state of that file to the $PAGER. This is something that 'git diff' does not do. Note that <filename> doesn't even have to exist on the current branch, and you don't even have to have a working tree (i.e. you can do this in a bare repo to inspect file contents without actually needing to checkout a working copy of all of the code).git tag -a tagname
git push --tags
git checkout tagname
http://git.or.cz/course/svn.html
BTW, it's also worth noting that hg can have tag merge conflicts (http://mercurial.selenic.com/wiki/GitConcepts), which is just weird.
For anyone looking to learn more about git, I haven't found a better resource than this talk: (video) http://blip.tv/file/4094854 (slides) http://www.slideshare.net/chacon/getting-git
That said, I migrated from hg to git, and I love them both way more than svn.
- Python + Hg
- Ruby + Git
- PHP + ...SVN?
Gotta say, they deserve each other.
http://www.opencobol.org/ (http://sourceforge.net/projects/open-cobol/develop)
maybe a language older than that still uses RCS
I've checked files out that were last modified before I was born.
Maybe if we disparage them enough they'll switch to a real programming language and version control tool.
SVN users, well, they probably just don't know any better. :)
I don't do any PHP myself and my few forays into it didn't leave me impressed but I don't see how you can disparage it as not a "real language".
Yes, I've programmed in PHP and know it has some downsides, and that it has some big warts that are ugly, but it is a real programming language. Real projects are built with PHP.
Now I understand the frustration with Subversion, but it still is a version control system that is used in the real world. Would I love it if everyone decided to move away from SVN and onto something more capable like Git or Mercurial, yes, but that doesn't mean we have to belittle people who are using those tools.
1) It's very easy to get started with, even if you're not a great programmer (or even if you have never programmed before). Just start with pure HTML and then add a few <?php> tags. 2) Lots of PHP hosting available, much of it free. 3) Loads of frameworks and libraries available.
I'm sure a PHP fan could come up with a few more.
I think #1 is the big reason that PHP is as popular as it is, but that "feature" has a funny smell among programmers who don't like to mix languages.
http://googlecode.blogspot.com/2009/04/mercurial-support-for... http://code.google.com/p/support/wiki/DVCSAnalysis
Hg is written in Python. As for why Mercurial was chosen over Bazaar, it came down to popularity. As the core developer survey shows, hg was preferred over bzr.
hg seems to be strong at Google github was done in ruby php ... whatever
http://doc.bazaar.canonical.com/explorer/en/guide/qbzr/qdiff...
I would be interested to know about other's impressions of bazaar and why most people seem to share the same sentiment towards it as those at pycon that year
While no one said they did not want bzr chosen, no one said they did either.
The move from 1.x to 2.x brought in significant performance and memory improvements.
I am still unclear on the impact of a "branch" being the key concept in bzr as opposed to "repository" in git/hg.
Git's support on Windows has improved considerably (although I could not find a good GUI). So I rather find not much reason to use Hg!
http://mail.python.org/pipermail/python-dev/2011-March/10873...
For those asking "why not git", read http://www.python.org/dev/peps/pep-0374/
Basically, they wanted a tool that was equally usable on all platforms, which excluded Git on Windows.
They also wanted something written in Python, of course, although they would have sacrificed that in the interest of pragmatism.
Similarly, most Windows developers that I encounter who run Git just use TortoiseGit. (And TortoiseHg for Mercurial for that matter).
The whole "Git on Windows" issue? Completely overblown.
While mercurial being written in python is noted[1] , it is made explicitly clear, its not the reason behind the main selection of Hg as the version control.
[1] - http://www.python.org/dev/peps/pep-0374/#why-mercurial-over-...
This is FUD! The support for git on windows is pretty good and there is nothing obstrusive in it. You can use git on Windows fairly well. Sad to see this kind of comment written by smart people.
I agree with the grandparent, this decision was political.
It is true that git works on Windows, but that doesn't mean it works well.
I've never experienced the crashes you describe but I've never used Tortoise either. YMMV, I suppose.
Can hg set the current branch to point anywhere in time?
Does histedit do exactly what "rebase" does? Does it also work with "--onto" and other rebase features?
histedit does a variety of things; I'm not sure if it covers all of rebase's branches. Mercurial does also have a rebase facility now as well.
That is correct. In Mercurial, git's `rebase` is (sensibly, as far as I am concerned) split into two different commands: `histedit` handles the history edition within a branch and `rebase` handles the rebasing of a branch on a revision of an other branch.
There are a few limitations to `histedit` compared to `git rebase -i` I think: I believe it's possible to split revisions using `rebase -i`, I don't think that can be done using histedit (it has pick, edit, drop and fold). Histedit also misses the (pretty recent I believe) `exec` action of git's rebase -i.
The only real difference between the two are the ecosystems. Mercurial, being written is Python, is very portable and easily extensible. I feel like, because of that, the tools for Mercurial are better. Git has GitHub, and the incredible open source community they've developed there.
* Note, the rainbow road is due to one of the few differences between Git and Hg: Hg does not allow octopus merges, so the conversion turns them to a sequence of two at a time merges. Also, in the interest of full disclosure, I'm one of the devs on Kiln, so I'm certainly biased towards Hg.
$ git rev-list --merges --parents --tags | awk '{print (NF-1)}' | sort | uniq -c
4409 2
22 3
5 4
3 5
1 6
So there's been a total of 31 octopus merges compared to 4409 typical two-parent merges. 5 10
6 11
5 12
3 13
2 14
1 18
14592 2
1 20
1 21
1 24
129 3
1 30
50 4
25 5
21 6
13 7
18 8
7 9