Menu

[2275f9]: / using-git.xml  Maximize  Restore  History

Download this file

162 lines (116 with data), 4.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?xml version='1.0' encoding='utf-8'?>
<html lang="en">
<toc level='h2'/>
<h2>Testing developer versions using Git</h2>
<p>
If you want to work on the code, or test a fix that has just been made,
you'll want to get the latest developer version. We use Git for version
control, so make sure you have that. You'll also need '<a href='http://www.gnu.org/software/gettext/'>gettext-tools</a>' to build
the translations.
</p>
<p>
To install these on Ubuntu, open a terminal emulator and run this command:
</p>
<pre>$ sudo apt-get install git gitk gettext</pre>
<p>(gitk is a largish visualisation tool and is not strictly necessary, but highly recommended)</p>
<p>Click on the <b>SCM</b> link on any program's page to see its Git page
(for example, <a href='https://github.com/0install/0install'>0install.git</a> for 0install itself).
The link for cloning is displayed there; use it like this:</p>
<pre>
$ git clone https://github.com/0install/0install.git
$ cd 0install
</pre>
<p>
The directory contains the latest version, plus a single (hidden) .git
directory with all the git-related bits.
</p>
<p>To see the log:</p>
<pre>
$ git log
</pre>
<p>
This doesn't require network access; your clone has the whole history.
</p>
<p>
To view a visualisation of the history:
</p>
<pre>
$ gitk --all
</pre>
<p>(--all shows the history of all branches and tags, not just the main trunk)</p>
<h2>Fetching updates</h2>
<p>To download the latest updates into your copy:</p>
<pre>
$ git pull --rebase
</pre>
<p>
(The --rebase option says that if you've committed some changes locally, they should be
reapplied on top of the latest version. Otherwise, it would create a merge commit, which
is usually not what you want.)
</p>
<p>
You can also pull from other places. If someone posts to the mailing list,
they will tell you where to pull from to try the feature out. If they send
a patch, you can apply it with:
</p>
<pre>$ git am the.patch</pre>
<h2>Understanding the code</h2>
<p>
Most modules have two files - a <tt>.ml</tt> file containing the implementation and a <tt>.mli</tt>
file describing the module's public interface. You should always start by reading the <tt>.mli</tt>
file. <a href='https://github.com/0install/0install/blob/master/ocaml/zeroinstall/sigs.mli'>sigs.mli</a> describes several abstract interfaces used in the code.
</p>
<p>
<a href='http://roscidus.com/blog/blog/archives/'>Thomas Leonard's blog</a>
has many blog posts describing various aspects of 0install.
For example, <a href='http://roscidus.com/blog/blog/2014/09/17/simplifying-the-solver-with-functors/'>Simplifying the Solver With Functors</a> explains how 0install chooses a compatible set of libraries to run a program, while <a href='http://roscidus.com/blog/blog/2013/11/28/asynchronous-python-vs-ocaml/'>Asynchronous Python vs OCaml</a> describes the code for downloading things.
</p>
<h2>Making patches</h2>
<p>
If you've changed the code in some way then you can commit the changes like
this (this just stores them on your own computer, in the .git sub-directory).
</p>
<pre>$ git commit -a</pre>
<p>Enter a log message. The first line should be a short summary (like the
subject of an email). Then leave a blank line, then write a longer description.
</p>
<p>To view your patch after committing:</p>
<pre>$ git show</pre>
<p>If you realised you made a mistake, correct it and then do:</p>
<pre>$ git commit -a --amend</pre>
<p>
Finally, to make a patch file ready to send to the <a href='support.html'>mailing list</a>:
</p>
<pre>$ git format-patch origin/master</pre>
<h2>Making a new translation</h2>
<p>
Note: translations are not currently working - see <a href='http://stackoverflow.com/questions/26192129/gettext-support-in-ocaml'>Gettext support in OCaml</a>.
</p>
<p>Note: if you prefer, you can also use the <a href='https://www.transifex.net/projects/p/0install/'>Transifex web interface</a> to work on translations.
</p>
<p>The steps are:</p>
<ol>
<li>Create the .pot (.po template) file.</li>
<li>Create a new directory <b>share/locale/<i>$locale</i>/LC_MESSAGES</b> inside the Git checkout.</li>
<li>Copy the .pot file inside it with a .po extension.</li>
</ol>
<p>
e.g. to make a French translation:
</p>
<pre>
$ make share/locale/zero-install.pot
$ mkdir -p share/locale/<b>fr</b>/LC_MESSAGES
$ cp share/locale/zero-install.pot share/locale/<b>fr</b>/LC_MESSAGES/zero-install.po
</pre>
<p>
Then edit the .po file to give a translation for each string. When you're done, create the .mo
file from the .po file and test:
</p>
<pre>
$ make translations
$ ./0launch
</pre>
<p>
Finally, <a href='support.html'>send us</a> the new .po file.
</p>
</html>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.