Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database & Information Systems Group University of Basel DBIS Group Talk Michael Springmann 2009-03-11 Distributed Source Code Management in Mercurial.

Similar presentations


Presentation on theme: "Database & Information Systems Group University of Basel DBIS Group Talk Michael Springmann 2009-03-11 Distributed Source Code Management in Mercurial."— Presentation transcript:

1 Database & Information Systems Group University of Basel DBIS Group Talk Michael Springmann 2009-03-11 Distributed Source Code Management in Mercurial

2 2 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group Mercurial (Hg) I.DSCM implemented in Python / few C, GPL 2  Abbreviated relating to chemical symbol Hg for Mercury II.Used by:  OpenJDK, Netbeans, OpenSolaris, Mozilla, Xen, GNU Octave...  DBIS? III.Not as fast as git for many tasks  but still considered significantly faster than Subversion  rather intuitive command set for former SVN users  portable 2

3 3 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group Basic Separation in SCM I.Working Directory  every developer has his own working directory  contains not only the essential source code and build scripts but commonly also: generated source code generated documentation compiled results, linked libraries / executables, generated packages log files of test runs (temporary) files generated by the used IDE II.Repository  provides revision control  provides possibility to exchange code with other developers 3

4 4 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group Getting started I.No working directory without repository  Either clone existing repository every clone is a fully functional repository containing all changesets from the beginning to the current stage (in compressed, space-efficient form) every clone is a branch that can be synchronized via pulls and pushes with any other branch / (related) repository from a file perspective: copies all files in.hg-directory –except.hg/hgrc –and will perform update on working directory from copied repo  or start a new repository via init can be created in empty, existing directory can be created in any non-empty directory that is not yet controlled by Mercurial can create a new directory will generate the.hg-directory with all required files (but empty) 4

5 5 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group hg init I.Inside an existing directory  hg init II.Outside of the directory  hg init 5

6 6 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group Adding / removing files I.Putting files under version control  hg add [...] II.Ignoring files from Mercurial  Listing ignore patterns in.hgignore file e.g. III.Remove file that is no longer needed  in working directory of any subsequent revision (or at least shouldn’t get controlled  hg remove [...] 6 # use glob syntax.syntax: glob**/bin*.class*~# switch to regexp syntax.syntax: regexp^\.pc/AUTHOR

7 7 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group Checking status and addremove I.Mercurial can display the status of the dir w.r.t. repo  hg status  shows added ( A ), removed ( R ), modified ( M ), missing ( ! ) and files with unkown status ( ? ) because there is no corresponding record in the repo yet. II.Shorthand to add all new (unknown files) and remove all missing files  hg addremove  will at the same time try to identify moved files  explicit move: hg rename III.All this gets only persisted in repository upon commit  hg commit [--message “ ”]  GUI frequently display status upon commit and allow add/remove at the same time they let you enter a message 7

8 8 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group Displaying the history I.Simple textual log of commits  hg log [--patch] II.View commit history as a graph  for better illustration of branches and merges  hg glog  Graphical tools as GUI or in web browser with hg serve 8

9 9 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group 9

10 10 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group 10

11 11 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group 11

12 12 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group Distributed Repositories 12 Repo 1Repo 2 propagate changes between repos synchronizes local working copy with local repository I.Two basic kinds of communication

13 13 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group Some basic, common commands I.Local Repository  init  [g]log  verify  heads  tip  tag  tags  branch  branches 13 other Repo  clone  pull  push  serve  incoming  outgoing  export  import  bundle  unbundle Working Dir  status  add  remove  addremove  commit  update  revert  branch  merge  resolve Shortcuts for frequent tasks like fetch pullmerge if needed commit if automatic merge successful, otherwise update for manual intervention

14 14 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group Cloning a repository I.Cloning from a mercurial source  from local file, ssh, http(s)  hg clone [ ]  will set up a new.hg/hgrc II.Propagating changes  hg pull [--update] [ ]  hg push [ ]  hg bundle / unbundle III.Synching the working directory with changes  hg update 14 [paths]default =

15 15 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group Merging I.Branches may co-exist in repo  as seen in graph of revisions  Merge starts only when triggered hg merge hg fetch II.Results in a list of outstanding conflicts if not resolved  hg resolve --list III.Redo unresolved merge  hg resolve IV.Commit after merge! 15

16 16 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group 16

17 17 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group 17

18 18 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group 18

19 19 2009-03-11 Distributed Source Code Management in Mercurial- Database & Information Systems Group Converting a repository I.There’s more than one way to do it!  hgsvn  hg convert example: hg convert http://on.cs.unibas.ch/svn/repos/on/trunk/on-dht my-on-dht-branchhttp://on.cs.unibas.ch/svn/repos/on/trunk/on-dht 19


Download ppt "Database & Information Systems Group University of Basel DBIS Group Talk Michael Springmann 2009-03-11 Distributed Source Code Management in Mercurial."

Similar presentations


Ads by Google