GettingPintosCode » History » Version 3
Borja Sotomayor, 12/09/2010 11:32 AM
1 | 1 | Borja Sotomayor | h1. Getting the Pintos code into your PhoenixForge repository |
---|---|---|---|
2 | 1 | Borja Sotomayor | |
3 | 2 | Borja Sotomayor | Although you could just check out or export the Pintos code, and then commit it to your repository, we prefer that you use an intermediate _external branch_ in your repository. We don't expect that we'll have to make any changes to the provided Pintos code (since it has been pretty thoroughly tested in many other OS courses) but, if we do, using an external branch will make it easier for you to merge those changes into your code. The process for getting the code into your repository, by way of an external branch, is described here. 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. |
4 | 2 | Borja Sotomayor | |
5 | 2 | Borja Sotomayor | h2. Copying the code into your repository |
6 | 2 | Borja Sotomayor | |
7 | 1 | Borja Sotomayor | To import the Pintos code into your repository, first do the following in a temporary directory: |
8 | 1 | Borja Sotomayor | |
9 | 1 | Borja Sotomayor | <pre> |
10 | 3 | Borja Sotomayor | svn export https://phoenixforge.cs.uchicago.edu/svn/pintos/trunk pintos |
11 | 1 | Borja Sotomayor | </pre> |
12 | 1 | Borja Sotomayor | |
13 | 1 | Borja Sotomayor | |
14 | 1 | Borja Sotomayor | This will create a directory called @pintos@, containing the Pintos code. Now, import it into your group's repository like this: |
15 | 1 | Borja Sotomayor | |
16 | 1 | Borja Sotomayor | <pre> |
17 | 1 | Borja Sotomayor | svn import pintos https://phoenixforge.cs.uchicago.edu/svn/my-group-name/external/pintos |
18 | 1 | Borja Sotomayor | </pre> |
19 | 1 | Borja Sotomayor | |
20 | 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: |
21 | 1 | Borja Sotomayor | |
22 | 1 | Borja Sotomayor | <pre> |
23 | 1 | Borja Sotomayor | svn copy https://phoenixforge.cs.uchicago.edu/svn/my-group-name/external/pintos \ |
24 | 1 | Borja Sotomayor | https://phoenixforge.cs.uchicago.edu/svn/my-group-name/trunk/pintos \ |
25 | 1 | Borja Sotomayor | --parents |
26 | 1 | Borja Sotomayor | </pre> |
27 | 1 | Borja Sotomayor | |
28 | 1 | Borja Sotomayor | |
29 | 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: |
30 | 1 | Borja Sotomayor | |
31 | 1 | Borja Sotomayor | <pre> |
32 | 1 | Borja Sotomayor | svn checkout https://phoenixforge.cs.uchicago.edu/svn/my-group-name/external/pintos |
33 | 1 | Borja Sotomayor | </pre> |
34 | 1 | Borja Sotomayor | |
35 | 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: |
36 | 1 | Borja Sotomayor | |
37 | 1 | Borja Sotomayor | <pre> |
38 | 1 | Borja Sotomayor | svn checkout https://phoenixforge.cs.uchicago.edu/svn/my-group-name/trunk/pintos |
39 | 1 | Borja Sotomayor | </pre> |
40 | 1 | Borja Sotomayor | |
41 | 2 | Borja Sotomayor | h2. Propagating changes into your repository |
42 | 1 | Borja Sotomayor | |
43 | 2 | Borja Sotomayor | Now, let's say that there have been changes to the Pintos code that we provide. Merging them into your trunk is a two-step process: |
44 | 2 | Borja Sotomayor | |
45 | 1 | Borja Sotomayor | # Update the external branch in your repository with the latest Pintos code. |
46 | 1 | Borja Sotomayor | # Merge the new Pintos code into your own, resolving any conflicts if necessary. |
47 | 1 | Borja Sotomayor | |
48 | 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. |
49 | 1 | Borja Sotomayor | |
50 | 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 |
51 | 1 | Borja Sotomayor | |
52 | 1 | Borja Sotomayor | |
53 | 1 | Borja Sotomayor | <pre> |
54 | 1 | Borja Sotomayor | svn merge https://phoenixforge.cs.uchicago.edu/svn/my-group-name/external/pintos \ |
55 | 1 | Borja Sotomayor | $MAIN_DIR |
56 | 1 | Borja Sotomayor | </pre> |
57 | 1 | Borja Sotomayor | |
58 | 1 | Borja Sotomayor | If you're lucky, and there are no conflicts, you will see something like this: |
59 | 1 | Borja Sotomayor | |
60 | 1 | Borja Sotomayor | <pre> |
61 | 1 | Borja Sotomayor | --- Merging r3 through r5 into 'pintos': |
62 | 1 | Borja Sotomayor | U pintos/tests/main.h |
63 | 1 | Borja Sotomayor | U pintos/Makefile.kernel |
64 | 1 | Borja Sotomayor | </pre> |
65 | 1 | Borja Sotomayor | |
66 | 1 | Borja Sotomayor | If a conflict happens, then you will be given the option to resolve it manually: |
67 | 1 | Borja Sotomayor | |
68 | 2 | Borja Sotomayor | <pre> |
69 | 1 | Borja Sotomayor | Conflict discovered in 'pintos/tests/main.h'. |
70 | 1 | Borja Sotomayor | Select: (p) postpone, (df) diff-full, (e) edit, |
71 | 2 | Borja Sotomayor | (h) help for more options: |
72 | 2 | Borja Sotomayor | </pre> |
73 | 1 | Borja Sotomayor | |
74 | 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@. |
75 | 1 | Borja Sotomayor | |
76 | 1 | Borja Sotomayor | Once the merge is complete, you have to run @svn commit@ to actually commit the merged version into your main branch. |