README_REPOSITORY
author wenzelm
Fri Aug 17 17:35:07 2012 +0200 (2012-08-17)
changeset 48844 6408fb6f7d81
parent 48497 ba61aceaa18a
child 48853 ec82c33c75f8
permissions -rw-r--r--
some explanations on isabelle components;
wenzelm@28907
     1
Important notes on Mercurial repository access for Isabelle
wenzelm@28907
     2
===========================================================
wenzelm@28907
     3
wenzelm@40601
     4
Introduction
wenzelm@40601
     5
------------
wenzelm@28907
     6
wenzelm@40601
     7
Mercurial http://www.selenic.com/mercurial belongs to the current
wenzelm@40601
     8
generation of source code management systems that follow the so-called
wenzelm@40601
     9
paradigm of "distributed version control".  This is a terrific name
wenzelm@40601
    10
for plain revision control without the legacy of CVS or SVN.  See also
wenzelm@40601
    11
http://hginit.com/ for an introduction to the main ideas.  The
wenzelm@40601
    12
Mercurial book http://hgbook.red-bean.com/ explains many more details.
wenzelm@40601
    13
wenzelm@40601
    14
Mercurial offers great flexibility in organizing the flow of changes,
wenzelm@40601
    15
both between individual developers and designated pull/push areas that
wenzelm@40601
    16
are shared with others.  This additional power demands some additional
wenzelm@40601
    17
responsibility to maintain a certain development process that fits to
wenzelm@40601
    18
a particular project.
wenzelm@28907
    19
wenzelm@40601
    20
Regular Mercurial operations are strictly monotonic, where changeset
wenzelm@40601
    21
transactions are only added, but never deleted.  There are special
wenzelm@40601
    22
tools to manipulate repositories via non-monotonic actions (such as
wenzelm@40601
    23
"rollback" or "strip"), but recovering from gross mistakes that have
wenzelm@40601
    24
escaped into the public can be hard and embarrassing.  It is much
wenzelm@40601
    25
easier to inspect and amend changesets routinely before pushing.
wenzelm@28907
    26
wenzelm@40601
    27
The effect of the critical "pull" / "push" operations can be tested in
wenzelm@40601
    28
a dry run via "incoming" / "outgoing".  The "fetch" extension includes
wenzelm@40601
    29
useful sanity checks beyond raw "pull" / "update" / "merge".  Most
wenzelm@40601
    30
other operations are local to the user's repository clone.  This gives
wenzelm@40601
    31
some freedom for experimentation without affecting anybody else.
wenzelm@40601
    32
wenzelm@40601
    33
Mercurial provides nice web presentation of incoming changes with a
wenzelm@40601
    34
digest of log entries; this also includes RSS/Atom news feeds.  There
wenzelm@47449
    35
are add-on history browsers such as "hg view" and TortoiseHg.  Unlike
wenzelm@47449
    36
the default web view, some of these tools help to inspect the semantic
wenzelm@47449
    37
content of non-trivial merge nodes.
wenzelm@28907
    38
wenzelm@28907
    39
wenzelm@28907
    40
Initial configuration
wenzelm@29481
    41
---------------------
wenzelm@28907
    42
wenzelm@28913
    43
The official Isabelle repository can be cloned like this:
wenzelm@28907
    44
wenzelm@28907
    45
  hg clone http://isabelle.in.tum.de/repos/isabelle
wenzelm@28907
    46
wenzelm@28907
    47
This will create a local directory "isabelle", unless an alternative
wenzelm@28907
    48
name is specified.  The full repository meta-data and history of
wenzelm@28907
    49
changes is in isabelle/.hg; local configuration for this clone can be
wenzelm@28907
    50
added to isabelle/.hg/hgrc, but note that hgrc files are never copied
wenzelm@40601
    51
by another clone operation.
wenzelm@28907
    52
wenzelm@28917
    53
wenzelm@28913
    54
There is also $HOME/.hgrc for per-user Mercurial configuration.  The
wenzelm@40601
    55
initial configuration requires at least an entry to identify yourself
wenzelm@40601
    56
as follows:
wenzelm@28907
    57
wenzelm@28907
    58
  [ui]
wenzelm@40601
    59
  username = XXX
wenzelm@28907
    60
wenzelm@40601
    61
Isabelle contributors are free to choose either a short "login name"
wenzelm@40601
    62
(for accounts at TU Munich) or a "full name" -- with or without mail
wenzelm@40601
    63
address.  It is important to stick to this choice once and for all.
wenzelm@40601
    64
The machine default that Mercurial produces for unspecified
wenzelm@40601
    65
[ui]username is not appropriate.
wenzelm@28907
    66
wenzelm@40601
    67
Such configuration can be given in $HOME/.hgrc (for each home
wenzelm@40601
    68
directory on each machine) or in .hg/hgrc (for each repository clone).
wenzelm@28907
    69
wenzelm@28907
    70
wenzelm@40601
    71
Here are some further examples for hgrc.  This is how to provide
wenzelm@40601
    72
default options for common commands:
wenzelm@28907
    73
wenzelm@28907
    74
  [defaults]
wenzelm@28907
    75
  log = -l 10
wenzelm@28907
    76
wenzelm@40601
    77
This is how to configure some extension, which is called "graphlog"
wenzelm@40601
    78
and provides the "glog" command:
wenzelm@28907
    79
wenzelm@28907
    80
  [extensions]
wenzelm@28907
    81
  hgext.graphlog =
wenzelm@28907
    82
wenzelm@28907
    83
wenzelm@28907
    84
Shared pull/push access
wenzelm@29481
    85
-----------------------
wenzelm@28907
    86
wenzelm@28907
    87
The entry point http://isabelle.in.tum.de/repos/isabelle is world
wenzelm@28907
    88
readable, both via plain web browsing and the hg client as described
wenzelm@40601
    89
above.  Anybody can produce a clone, change it locally, and then use
wenzelm@40601
    90
regular mechanisms of Mercurial to report changes upstream, say via
wenzelm@40601
    91
mail to someone with write access to that file space.  It is also
wenzelm@40601
    92
quite easy to publish changed clones again on the web, using the
wenzelm@40601
    93
ad-hoc command "hg serve -v", or the hgweb.cgi or hgwebdir.cgi scripts
wenzelm@40601
    94
that are included in the Mercurial distribution, and send a "pull
wenzelm@40601
    95
request" to someone else.  There are also public hosting services for
wenzelm@40601
    96
Mercurial repositories.
wenzelm@28907
    97
wenzelm@28913
    98
The downstream/upstream mode of operation is quite common in the
wenzelm@28907
    99
distributed version control community, and works well for occasional
wenzelm@28907
   100
changes produced by anybody out there.  Of course, upstream
wenzelm@28907
   101
maintainers need to review and moderate changes being proposed, before
wenzelm@40601
   102
pushing anything onto the official Isabelle repository at TUM.  Direct
wenzelm@40601
   103
pushes are also reviewed routinely in a post-hoc fashion; everybody
wenzelm@40601
   104
hooked on the main repository is called to keep an eye on incoming
wenzelm@40601
   105
changes.  In any case, changesets need to be understandable, at the
wenzelm@40601
   106
time of writing and many years later.
wenzelm@28907
   107
wenzelm@40601
   108
Push access to the Isabelle repository requires an account at TUM,
wenzelm@47449
   109
with properly configured ssh to the local machines (e.g. macbroy20 ..
wenzelm@47449
   110
macbroy29).  You also need to be a member of the "isabelle" Unix
wenzelm@40601
   111
group.
wenzelm@28907
   112
wenzelm@28913
   113
Sharing a locally modified clone then works as follows, using your
wenzelm@28913
   114
user name instead of "wenzelm":
wenzelm@28913
   115
wenzelm@47449
   116
  hg out ssh://wenzelm@macbroy20//home/isabelle-repository/repos/isabelle
wenzelm@28907
   117
wenzelm@28913
   118
In fact, the "out" or "outgoing" command performs only a dry run: it
wenzelm@28913
   119
displays the changesets that would get published.  An actual "push",
wenzelm@28913
   120
with a lasting effect on the Isabelle repository, works like this:
wenzelm@28907
   121
wenzelm@47449
   122
  hg push ssh://wenzelm@macbroy20//home/isabelle-repository/repos/isabelle
wenzelm@28913
   123
wenzelm@28907
   124
wenzelm@40601
   125
Default paths for push and pull can be configured in
wenzelm@40601
   126
isabelle/.hg/hgrc, for example:
wenzelm@28907
   127
wenzelm@28907
   128
  [paths]
wenzelm@47449
   129
  default = ssh://wenzelm@macbroy20//home/isabelle-repository/repos/isabelle
wenzelm@28907
   130
wenzelm@28913
   131
Now "hg pull" or "hg push" will use that shared file space, unless a
wenzelm@28913
   132
different URL is specified explicitly.
wenzelm@28913
   133
wenzelm@28913
   134
When cloning a repository, the default path is set to the initial
wenzelm@28913
   135
source URL.  So we could have cloned via that ssh URL in the first
wenzelm@28913
   136
place, to get exactly to the same point:
wenzelm@28913
   137
wenzelm@47449
   138
  hg clone ssh://wenzelm@macbroy20//home/isabelle-repository/repos/isabelle
wenzelm@28907
   139
wenzelm@28907
   140
wenzelm@40601
   141
Simple merges
wenzelm@40601
   142
-------------
wenzelm@30182
   143
wenzelm@30182
   144
The main idea of Mercurial is to let individual users produce
wenzelm@30182
   145
independent branches of development first, but merge with others
wenzelm@30182
   146
frequently.  The basic hg merge operation is more general than
wenzelm@30182
   147
required for the mode of operation with a shared pull/push area.  The
wenzelm@40601
   148
"fetch" extension accommodates this case nicely, automating trivial
wenzelm@30182
   149
merges and requiring manual intervention for actual conflicts only.
wenzelm@30182
   150
wenzelm@40601
   151
The fetch extension can be configured via $HOME/.hgrc like this:
wenzelm@30182
   152
wenzelm@30182
   153
  [extensions]
wenzelm@30182
   154
  hgext.fetch =
wenzelm@30182
   155
wenzelm@30182
   156
  [defaults]
wenzelm@30182
   157
  fetch = -m "merged"
wenzelm@30182
   158
wenzelm@40601
   159
To keep merges semantically trivial and prevent genuine merge
wenzelm@40601
   160
conflicts or lost updates, it is essential to observe to following
wenzelm@40601
   161
general discipline wrt. the public Isabelle push area:
wenzelm@40601
   162
wenzelm@40601
   163
  * Before editing, pull or fetch the latest version.
wenzelm@40601
   164
wenzelm@40601
   165
  * Accumulate private commits for a maximum of 1-3 days.
wenzelm@40601
   166
wenzelm@40601
   167
  * Start publishing again by pull or fetch, which normally produces
wenzelm@40601
   168
    local merges.
wenzelm@40601
   169
wenzelm@40601
   170
  * Test the merged result as usual and push back in real time.
wenzelm@40601
   171
wenzelm@40601
   172
Piling private changes and public merges longer than 0.5-2 hours is
wenzelm@40601
   173
apt to produce some mess when pushing eventually!
wenzelm@30182
   174
wenzelm@30182
   175
wenzelm@28907
   176
Content discipline
wenzelm@29481
   177
------------------
wenzelm@28907
   178
wenzelm@40601
   179
The following principles should be kept in mind when producing
wenzelm@40601
   180
changesets that are meant to be published at some point.
wenzelm@28907
   181
wenzelm@40601
   182
  * The author of changes needs to be properly identified, using
wenzelm@40601
   183
    [ui]username configuration as described above.
wenzelm@28907
   184
wenzelm@28907
   185
    While Mercurial also provides means for signed changesets, we want
wenzelm@28907
   186
    to keep things simple and trust that users specify their identity
wenzelm@40601
   187
    correctly (and uniquely).
wenzelm@28907
   188
wenzelm@28907
   189
  * The history of sources is an integral part of the sources
wenzelm@28907
   190
    themselves.  This means that private experiments and branches
wenzelm@40601
   191
    should not be published by accident.  Named branches are not
wenzelm@40601
   192
    allowed on the public version.  Note that old SVN-style branching
wenzelm@40601
   193
    is replaced by regular repository clones in Mercurial.
wenzelm@28907
   194
wenzelm@40601
   195
    Exchanging local experiments with some other users can be done
wenzelm@40601
   196
    directly on peer-to-peer basis, without affecting the central
wenzelm@40601
   197
    pull/push area.
wenzelm@28907
   198
wenzelm@28907
   199
  * Log messages are an integral part of the history of sources.
wenzelm@40601
   200
    Other people will have to inspect them routinely, to understand
wenzelm@40601
   201
    why things have been done in a certain way at some point.
wenzelm@40601
   202
wenzelm@40601
   203
    Authors of log entries should be aware that published changes are
wenzelm@40601
   204
    actually read.  The main point is not to announce novelties, but
wenzelm@40601
   205
    to describe faithfully what has been done, and provide some clues
wenzelm@40601
   206
    about the motivation behind it.  The main recipient is someone who
wenzelm@40601
   207
    needs to understand the change in the distant future to isolate
wenzelm@40601
   208
    problems.  Sometimes it is helpful to reference past changes via
wenzelm@40601
   209
    changeset ids in the log entry.
wenzelm@28907
   210
wenzelm@40601
   211
  * The standard changelog entry format of the Isabelle repository
wenzelm@40601
   212
    admits several (vaguely related) items to be rolled into one
wenzelm@40601
   213
    changeset.  Each item is then described on a separate line that
wenzelm@40601
   214
    may become longer as screen line and is terminated by punctuation.
wenzelm@40601
   215
    These lines are roughly ordered by importance.
wenzelm@28907
   216
wenzelm@40601
   217
    This format conforms to established Isabelle tradition.  In
wenzelm@40601
   218
    contrast, the default of Mercurial prefers a single headline
wenzelm@40601
   219
    followed by a long body text.  The reason for that is a somewhat
wenzelm@40601
   220
    different development model of typical "distributed" projects,
wenzelm@40601
   221
    where external changes pass through a hierarchy of reviewers and
wenzelm@40601
   222
    maintainers, until they end up in some authoritative repository.
wenzelm@40601
   223
    Isabelle changesets can be more spontaneous, growing from the
wenzelm@40601
   224
    bottom-up.
wenzelm@40601
   225
wenzelm@40601
   226
    The web style of http://isabelle.in.tum.de/repos/isabelle/
wenzelm@40601
   227
    accommodates the Isabelle changelog format.  Note that multiple
wenzelm@40601
   228
    lines will sometimes display as a single paragraph in HTML, so
wenzelm@40601
   229
    some terminating punctuation is required.  Do not squeeze multiple
wenzelm@40601
   230
    items on the same line in the original text!
wenzelm@28907
   231
wenzelm@28907
   232
wenzelm@32361
   233
Building a repository version of Isabelle
wenzelm@32361
   234
-----------------------------------------
wenzelm@28908
   235
wenzelm@48844
   236
The regular "isabelle build" tool allows to build session images as
wenzelm@48844
   237
usual, but this first requires to resolve add-on components first,
wenzelm@48844
   238
including the ML system.  Some extra configuration is required to
wenzelm@48844
   239
approximate some of the system integration of official Isabelle
wenzelm@48844
   240
releases from a bare-bones repository snapshot.  The special directory
wenzelm@48844
   241
Admin/ -- which is absent in official releases -- might provide some
wenzelm@48844
   242
further clues.
wenzelm@48497
   243
wenzelm@48844
   244
Here is a reasonably easy way to include important Isabelle components
wenzelm@48844
   245
on the spot:
wenzelm@48844
   246
wenzelm@48844
   247
  (1) The bash script ISABELLE_HOME_USER/etc/settings is augmented by
wenzelm@48844
   248
  some shell function invocations like this:
wenzelm@28908
   249
wenzelm@48844
   250
      init_components "$HOME/.isabelle/contrib" "$ISABELLE_HOME/Admin/components/main"
wenzelm@48844
   251
      init_components "$HOME/.isabelle/contrib" "$ISABELLE_HOME/Admin/components/optional"
wenzelm@48844
   252
wenzelm@48844
   253
  This uses some central place "$HOME/.isabelle/contrib" to keep
wenzelm@48844
   254
  component directories that are shared by all Isabelle versions.
wenzelm@48844
   255
wenzelm@48844
   256
  (2) Missing components are resolved on the command line like this:
wenzelm@48497
   257
wenzelm@48844
   258
      isabelle components -a
wenzelm@48844
   259
wenzelm@48844
   260
  This will saturate the "$HOME/.isabelle/contrib" directory structure
wenzelm@48844
   261
  from according to $ISABELLE_COMPONENT_REPOSITORY.
wenzelm@48497
   262
wenzelm@48844
   263
Since the given component catalogs in $ISABELLE_HOME/Admin/components
wenzelm@48844
   264
are subject to the Mercurial history, it is possible to bisect over a
wenzelm@48844
   265
range of Isabelle versions while references to the contributing
wenzelm@48844
   266
components change accordingly.