Project

General

Profile

GettingPintosCode » History » Version 1

Borja Sotomayor, 12/03/2010 05:20 PM

1 1 Borja Sotomayor
h1. Getting the Pintos code into your PhoenixForge repository
2 1 Borja Sotomayor
3 1 Borja Sotomayor
To import the Pintos code into your repository, first do the following in a temporary directory:
4 1 Borja Sotomayor
5 1 Borja Sotomayor
<pre>
6 1 Borja Sotomayor
svn export https://phoenixforge.cs.uchicago.edu/svn/pintos/trunk/src pintos
7 1 Borja Sotomayor
</pre> 
8 1 Borja Sotomayor
9 1 Borja Sotomayor
10 1 Borja Sotomayor
This will create a directory called @pintos@, containing the Pintos code. Now, import it into your group's repository like this:
11 1 Borja Sotomayor
12 1 Borja Sotomayor
<pre>
13 1 Borja Sotomayor
svn import pintos https://phoenixforge.cs.uchicago.edu/svn/my-group-name/external/pintos
14 1 Borja Sotomayor
</pre>
15 1 Borja Sotomayor
16 1 Borja Sotomayor
Notice how, we're not importing the Pintos code into the @trunk@ directory (which is typically used to contain the ``main branch'' of your code). To keep your code synchronized with the Pintos code, we are going to make use of SVN's merge functionality, which requires that we keep this @external@ code in a separate directory (the _external branch_). Of course, you still want to have your own copy where you will actually be writing your own code (the _main branch_). We make this copy like this:
17 1 Borja Sotomayor
18 1 Borja Sotomayor
19 1 Borja Sotomayor
<pre>
20 1 Borja Sotomayor
svn copy https://phoenixforge.cs.uchicago.edu/svn/my-group-name/external/pintos \
21 1 Borja Sotomayor
         https://phoenixforge.cs.uchicago.edu/svn/my-group-name/trunk/pintos \
22 1 Borja Sotomayor
         --parents
23 1 Borja Sotomayor
</pre>
24 1 Borja Sotomayor
25 1 Borja Sotomayor
26 1 Borja Sotomayor
Next, you need to create working copies for each of these two copies. _You need to keep these in separate directories_. So, in an empty directory (we will refer to it as @$BASE_DIR@) run the following to create a working copy of the Pintos code:
27 1 Borja Sotomayor
28 1 Borja Sotomayor
<pre>
29 1 Borja Sotomayor
svn checkout https://phoenixforge.cs.uchicago.edu/svn/my-group-name/external/pintos
30 1 Borja Sotomayor
</pre>
31 1 Borja Sotomayor
32 1 Borja Sotomayor
And, _in a separate directory_ (we will refer to this one as @$MAIN_DIR@), run the following to create a working copy of your main branch:
33 1 Borja Sotomayor
34 1 Borja Sotomayor
<pre>
35 1 Borja Sotomayor
svn checkout https://phoenixforge.cs.uchicago.edu/svn/my-group-name/trunk/pintos
36 1 Borja Sotomayor
</pre>
37 1 Borja Sotomayor
38 1 Borja Sotomayor
Now, let's say that there have been changes to the Pintos code and you want to merge them into your main branch. This is a two-step process:
39 1 Borja Sotomayor
40 1 Borja Sotomayor
# Update the external branch in your repository with the latest Pintos code.
41 1 Borja Sotomayor
# Merge the new Pintos code into your own, resolving any conflicts if necessary.
42 1 Borja Sotomayor
43 1 Borja Sotomayor
The first step is the kludgiest one, but also highly scriptable (SVN includes a script called @svn_load_dirs.pl@ that can help you automate this step. You essentially have to @svn import@ the Pintos code again, and overwrite the code in @$BASE_DIR@ with the newest version. If necessary, you may have to manually run @svn add@ to add new files and @svn delete@ to remove files that are no longer present in the latest version of the Pintos code. Once you have done this, just run @svn commit@ to commit the new version into your external branch.
44 1 Borja Sotomayor
45 1 Borja Sotomayor
The second step is handled by @svn merge@ which, in the best case, will automatically merge all the new code into your own but, in the worst case, will require you to resolve conflicts between your code and the latest version of the Pintos code. To merge the code, run the following
46 1 Borja Sotomayor
47 1 Borja Sotomayor
48 1 Borja Sotomayor
<pre>
49 1 Borja Sotomayor
svn merge https://phoenixforge.cs.uchicago.edu/svn/my-group-name/external/pintos \
50 1 Borja Sotomayor
          $MAIN_DIR
51 1 Borja Sotomayor
</pre>
52 1 Borja Sotomayor
53 1 Borja Sotomayor
If you're lucky, and there are no conflicts, you will see something like this:
54 1 Borja Sotomayor
55 1 Borja Sotomayor
<pre>
56 1 Borja Sotomayor
--- Merging r3 through r5 into 'pintos':
57 1 Borja Sotomayor
U    pintos/tests/main.h
58 1 Borja Sotomayor
U    pintos/Makefile.kernel
59 1 Borja Sotomayor
</pre>
60 1 Borja Sotomayor
61 1 Borja Sotomayor
If a conflict happens, then you will be given the option to resolve it manually:
62 1 Borja Sotomayor
63 1 Borja Sotomayor
\begin{verbatim}
64 1 Borja Sotomayor
Conflict discovered in 'pintos/tests/main.h'.
65 1 Borja Sotomayor
Select: (p) postpone, (df) diff-full, (e) edit,
66 1 Borja Sotomayor
        (h) help for more options: 
67 1 Borja Sotomayor
\end{verbatim}
68 1 Borja Sotomayor
69 1 Borja Sotomayor
@df@ will show a diff between your code and the code you are merging in, and @e@ will allow you to edit your code to resolve the conflicts manually. Once you've edited the file, you will be allowed to select the option @(r) resolve@.
70 1 Borja Sotomayor
71 1 Borja Sotomayor
Once the merge is complete, you have to run @svn commit@ to actually commit the merged version into your main branch.
72 1 Borja Sotomayor
73 1 Borja Sotomayor
Note: These instructions are based on the ``Vendor Branches'' section of the SVN book. See http://svnbook.red-bean.com/en/1.5/svn.advanced.vendorbr.html for more details.