Sei sulla pagina 1di 6

Head to head comparison between

SVN – GIT – MERCURIAL


Author: Animesh Das <animeshdas@yahoo.com>

SUBVERSION (aka SVN) GIT Mercurial (aka HG)


Offers a centralized repository Decentralized distributed repository Decentralized distributed
model. In other word SVN is one model. GIT is a repo with lots of client repository model. HG is a
repo and lots of clients. repos, each with a user. repo with lots of client
repos, each with a user.
Easier to use. Simple thus have Learning Git can be a bit daunting. Short learning curve, as the
lesser features. But once learned has much power, command set are similar to
flexibility and features than other has SVN and CVS.
to offer. With a GUI, it much easier
now.
The process of starting a new Very straight forward. Very straight forward.
project in SVN is still sort of a
pain - importing, then exporting
the project, etc. Also managing
a SVN repository too.
Written in mix of C and Perl Purely written in ANSI C. Written in Python, thus
have more flexibility of
adding new plugins, code
changes.
SVN is old-school and is around Git is the new kid on the block, Mercurial -another big
much longer. already cached much attention. And distributed system that's
Git deserves it’s popularity. out there (both were
created as a result of the
BitKeeper debacle) for
quite some time now.
Being older, already tons of Despite being young, already have Mercurial being written on
tools available. some good tools available for day to Python is cross platform
day work in Windows. and modular.
SVN cannot not handle huge and GIT is fast and excellent for managing Same as GIT.
complex project due to its large e or/and complex projects with
branching and merging model in a complex/simple lifecycle with
use. many/few collaborators
With SVN, everyone has a With GIT, everyone has their own Same as GIT
working copy and changes are copy of the entire repository.
committed to a central Basically, everyone is always working
repository. To work on a branch on their own branch and functional
a user must copy the trunk into code can later be merged into the
another directory and then master. So, people can track their
merge it back when complete. own edits locally without having to
push things to an external server.
With Subversion, you have to In Git, with each branch, no new files Mercurial also better allows
create every branch remotely on are created in the project file differences between the
the server. This can get messy hierarchy on your system. Since you HEAD branch (aka tip) and
depending on the size of your have a full local repository, Git your current working
team. If you decide to control creates the files you need on the fly directory state—you can
branching to keep things clean, by processing the recorded changes. push into a repository with
you forfeit the power branching a working directory without
offers. To understand the core difference of confusing Mercurial; not so
branching, merging and patch with Git. This means
between GIT and Mercurial ones must collaboration in Git requires
read a third copy of the
http://stevelosh.com/blog/entry/2009/ repository for collecting
8/30/a-guide-to-branching-in- commits (or requires that
mercurial/#conclusion repositories be updated
only by pull).
With Subversion, it all hits the With Git, we only push our work to Same as GIT
server. the server AFTER collaboration.
With Subversion, you still have Again, no file system work. Since Same as GIT
the old copy until you update. we’re using a local repository, we let
You either have to clean up Git handle the details of removing the
manually, or “update” to clean branch.
up local and remote copies.
With Subversion, you’re literally The key thing to note in this and Same as GIT
just working on a separate set of every step is how we switch between
files. Ultimately, it’s up to you branches. In Git, the repository
to manage retrieving and handles this.
editing these files.
Stashing temporary work, the Git will “float” uncommitted changes. Same as GIT
Subversion method is simpler, This means that if simply did a “git
but you could potentially end up checkout C,” you’d bring with you all
with several half-baked of the uncommitted work you did for
branches and no record of when A. However, you don’t want to
you abandoned them. commit A because it’s not in a good
working state. Instead, you “stash”
your work. Stash is like a work in
process commit. Using it will tuck
away your WIP changes without a
formal commit, which allows you to
change to C without “floating” any of
your A changes. Git’s stash allows
you to list all stashes, and even write
a message when you stash. It is far
more powerful in this scenario.
Collaboration before public Git has a nice feature to create Does not have this feature.
commits, with Subversion, it’s “patches.” They are simply changes
all on the server, all the time. to code, very similar to a diff. The
idea is that you create patches from
commits you’ve only made on your
local copy of the repository. When
your co-worker sent you the patch for
E, no one else on the team had to see
his commit logs, branches, etc., in the
public repository because they never
existed there. You are collaborating
about E via emailed patches.
SVN has so many client The problem is the Windows-aimed TortoiseHG is as much as
available on different platform. GIT client market is still pretty small. powerful as ToirtoiseSVN. It
Specially in Windows it has But still GIT ships with a basic GUI for has big client list for almost
excellent client like TortoiseSVN. day-to-day work, and for anything all platform.
advance(mostly required for repo
admin) you need to get into CLI.
There are some people working on a
Tortoise port for GIT and it is already
stable enough for normal daily work.
Subversion server has native It was originally heavily written for Platform independent.
ports to many OS. Have rich POSIX platform. But it work on other
client on different platform. platform on top of POSIX emulation
layer. One of the Google Summer of
Code projects was to replace much of
these scripts with more portable (and
faster) C code. It’s quite possible that
the upcoming 1.5.4 or 1.6.0 releases
mean native Git on Windows.
SVN cannot be used over GIT One can use GIT over SVN repository. Mercurial has hgsvn and its
repository. Git has excellent Subversion front- documentation suggests
ends. You can mirror an existing SVN that it can’t push changes
repository (say, the official version back into Subversion;
control system at the office) into Git,
develop using all of Git’s tools, then
push changes neatly back into
Subversion and Perforce.
SVN has limited set of GIT is very powerful in this area. When developing features,
functionality and the branching Compared to Mercurial, branching one would use Mercurial’s
merging hits performance and with Git is much easier. It is much patch queue extension to
becomes bottleneck for growing easier to use topic branches or git- develop features pieces
repository. stash to arrange (and re-arrange) until they were ready to
commits and do small fixes. Git’s commit. I would edit the
view of branch heads as simply series file manually to
pointers to some commit on a commit rearrange commits, in
graph and its constant tracking of particular to push out small
your commit history with reflogs bug-fixes. Thus in
around allows you to develop without Mercurial, (in around
fear of losing your work, even when version 0.9.4), branches in
arranging things so that your a single working tree were
published history is pretty. still somewhat confusing
and hard to use.
SVN is more suitable for small Suitable for both small and large, Suitable for both small and
team and projects. team and project. large, team and project.
In subversion, revisions are Git revisions are marked as SHA-1 Mercurial uses SHA-1
increasing integers, this is a hashes. Thus, if you want to do a diff hashes for revisions, too, it
pain. between two revisions, you have to also assigns local integers
use long, non-user friendly hashes. as aliases to the SHA-1
hashes. This means you
can still do things like hg
diff -r53 -r60. Because
these are local aliases only,
revision 53 on one
repository is not necessary
the same as revision 53 on
another, cloned, repository,
though. You’ll have to use
the full SHA-1 hash, which
is unique among
repositories.
Takes more diskspace. Takes lesser diskspaces. Its delta- Compared to GIT, it takes
against-parent model reduce 50% little bit more diskspace
space consumption. but quite lesser than SVN.
SVN is slow, speacially GIT is very very fast even with very Mercurial is fast too, but
branching, merging large repo large repository. not as GIT is. Mercurial
team is constantly working
to gain performance boot
in this area.
Works on top of Apache as Git uses a special protocol that runs Mercurial makes it
module. Also has svn over SSH over a dedicate port, making it extremely easy to serve up
server. somewhat less firewall friendly. a repository, without
requiring starting a
daemon on any special
ports. hg serve is all you
need and you can
efficiently clone a Mercurial
repository over HTTP;
Commits are atomic. Commits are atomic. Commits are atomic.
Renames are supported. Renames are supported for most Renames are supported.
practical purposes. Git even detects
renames when a file has been
changed afterward the rename.
However, due to a peculiar repository
structure, renames are not recorded
explicitly, and Git has to deduce them
(which works well in practice).
SVN does not support Intelligent Git does not have Intelligent Merging Yes, intelligent merging
Merging after Moves or after Moves or Renames. As detailed after renames is supported.
Renames. "svn help me" says in the Git FAQ: "Git has a rename the Mercurial book says: "If
"Note: this subcommand is command git mv, but that is just a I modify a file, and you
equivalent to a 'copy' and convenience. The effect is rename it to a new name,
'delete'." There's a bug report indistinguishable from removing the and then we merge our
about it. file and adding another with different respective changes, my
name and the same content." modifications to the file
under its original name will
be propagated into the file
under its new name. (This
is something you might
expect to 'simply work,' but
not all revision control
systems actually do this.)"
Support File and Directory No, It does not support File and Yes it support File and
Copies and it's a very cheap Directory Copies Directory Copies
operation (O(1)) that is also
utilized for branching.
Indirectly support of Remote This is very intrinsic feature of Git. Yes it support.
Repository Replication, by using
Chia-liang Kao's SVN::Mirror
add-on or Shlomi Fish' SVN-
Pusher utility.
Support Propagating Changes to Yes. (The Linux kernel development Yes it support.
Parent Repositories, using either process uses this extremely often)
Chia-Ling Kao's SVN::Mirror
script or the svn-push utility by
Shlomi Fish.
The WebDAV-based service See contrib/hooks/update-paranoid It is possible to lock down
supports defining HTTP that ships with Git. See the path_rules repositories, subdirectories,
permissions for various code for the closest equivalent to or files using hooks.
directories of the repository. svnperms. Not straight forward.
Subversion have partial Yes, Changesets are supported, and Yes. Changesets are
Changesets' support. There are there's some flexibility in creating supported.
implicit changeset that are them.
generated on each commit.
Support Tracking Line-wise File Support Tracking Line-wise File Support using hg diff.
History History. Also, branches are very
lightweight in Git, and could be
considered a kind of storage for
"uncommitted" code in some
workflows. Also see the "git stash"
command.
There is no such feature as Per- Commit messages are per changeset. There is no such feature as
File Commit Messages Per-File Commit Messages
Documentation is very good. Documentation is medium. The short Very good documentation.
There is a free online book and help is too terse and obscure. The There is a companion book
some online tutorials and man pages are extensive, but tend to and a wiki. Every command
resources. The book is written in be confusing. The are many tutorials. has integrated help.
DocBook/XML and so is
convertible to many different
formats. The command-line
client also provides a good
online help system that can be
used as a reference.
A Subversion service requires Binary packages are available for Excellent deployment
installing an Apache 2 module (if modern platforms. C compiler and functionality. Binary
one wishes to use HTTP as the Perl are required. Requires cygwin on packages are available for
underlying protocol) or its own Windows, and has some UNIXisms. all popular platforms.
proprietary server. The client Building from source
requires only the Subversion- requires only Python 2.3 (or
specific logic and the Neon later) and a C compiler.
WebDAV library (for HTTP).
Installation of the components is
quite straightforward, but will
require some work, assuming
Subversion does not come
prepackaged for one's system.
A CVS-like command set which Command set is very feature-rich, Commandset,tries to follow
is easy to get used to for CVS- and not compatible with CVS. CVS conventions, but
users. deviates where there is a
different design.
Networking support is very Excellent networking support. Can Networking support, uses
good. The Subversion service use native Git protocol, but works HTTP or ssh. Remote
can use either WebDAV+DeltaV over rsync, ssh, HTTP and HTTPS also. access also works safely
(which is HTTP or HTTPS based) without locks over read-
as its underylying protocol, or its only network filesystems.
own proprietary protocol that
can be channeled over an SSH
connection.
Portability : Excellent. Clients Portability : The client works on most Portability : Excellent. Runs
and Servers work on UNIX, UNIXes, but not on native MS- on all platforms supported
Windows and Mac OS X. Windows. The cygwin build seems to by Python. Repositories are
be workable, though. portable across CPU
architectures and endian
conventions.
Web Interface : Yes. ViewVC, Web Interface: Yes. Gitweb is Web Interface : Yes. The
SVN::Web, WebSVN, ViewSVN, included in distribution. web interface is a bundled
mod_svn_view, Chora, Trac, component.
SVN::RaWeb::Light, SVN
Browser, Insurrection and
perl_svn. Aside from that, the
Subversion Apache service
provides a rudimentary web-
interface.
Availability of Graphical User- Gitk is included in distribution. Qgit History viewing available
Interfaces is very good. There and Git-gui tools are also available. with hgit extension; check-
are many available GUIs: But have limited GUI available till in extension (hgct) makes
RapidSVN (cross-platform), date. Work in progress of cloning committing easier. Some
TortoiseSVN (Windows Explorer tortoise tool to support GIT. third-party IDEs and GUI
plug-in), Jsvn (Java), etc. Most of TortoiseGIT has release a stable tools (e.g. eric3, meld)
them are still under version of the GUI which is good have integrated Mercurial
development. enough for day to day work. support. Mercury now
support full blown Tortoise
client TortoiseHG.

In addition, try to do this scenario on your laptop while not connected to the Internet. With Git/HG, no
issues, the repository is local; however, with Subversion, you’re out of luck. Your new branches will
have to wait. The advantages of Git/HG for branching are clear in this simple branching scenario.

Both Mercurial and Git communities are working on TortoiseHg/TortoiseGit types of GUIs for Windows
users. Git appears to have a sane Windows port now as well.
For most uses, Mercurial and Git are more-or-less interchangeable, especially with the usability
improvements in versions 1.5 of Git and later. The most basic commands like status, diff, commit, and
log behave very similarly (at first glance). Commands execute quickly, even for large trees. Both
systems are very flexible with modules and scripts that bring most features to parity. For myself,
having learned how to work with Git, I prefer the power Git offers with fast branches and powerful tools
like reflogs and rebase. For the undecided, fortunately there are tools that convert repositories from
Git to Mercurial and vice-versa, so other than mental switching costs, there is little to fear in choosing
one or the other. I won’t be using Subversion or CVS any more if I can help it.

In conclusion, GIT or Mergurial(HG) stands out far better, robust and built keeping the requirement of
new breed of programmers and collaborated development environment in mind. And SVN is slowly
outdating. Now, please read this article to understand where GIT and Mercurial stands at this point.
http://texagon.blogspot.com/2008/02/use-mercurial-you-git.html

Potrebbero piacerti anche