blob: 7a0cd39dcc6f00fe641f72b40336dd25a9a3052c [file] [log] [blame]
jsseidel80666192017-09-19 13:29:23 -04001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2
3.. _updates-and-review:
4
5Updates and Review
6==================
7
8Most project owners will need only to concern themselves with their own
9project documentation. However, documentation team members and certain
10project owners will need to edit and test multiple documentation repositories.
11Fortunately, this is possible using git submodules.
12
13Git submodules
14--------------
15
16Git submodules are working copies of an upstream repository which you
17can clone inside your own project repositories. The documentation team
18uses them, for example, to keep up-to-date clones of each contributing
19project's :code:`docs` directory, found within the project repositories.
20
21For example:
22
23::
24
25 doc
26 +
27 |
28 + docs
29 +
30 |
31 + submodules
32 +
33 |
34 + ...
35 |
36 + cli.git
37 | +
38 | |
39 | + ...
40 | |
41 | + docs
42 | |
43 | + ...
44 |
45 + appc.git
46 | +
47 | |
48 | + ...
49 | |
50 | + docs
51 | |
52 | + ...
53 |
54 + ...
55
56
57When the doc team needs to build the master documentation, all the
58submodules are first updated before the build.
59
60Setting up Git Submodules as a Doc Team Member
61----------------------------------------------
62
63Look `here <https://git-scm.com/book/en/v2/Git-Tools-Submodules>`_ for a
64complete discussion of how to work with git submodules in any git
65project. In this section, we'll focus on how to work with project submodules with
66respect to the documentation.
67
68Doc team members must frequently update submodules to contribute grammar
69and spelling fixes, for example. The following describes the
70best-practice for doing so.
71
72First, set up your environment according the :ref:`directions for building the entire documentation tree <building-all-documentation>`
73and make sure you can build the documentation locally.
74
75Next, we'll need to checkout a branch for each submodule. Although you
76would rarely want to work on the master branch of a project repository
77when writing code, we'll stick to the master branch for documentation.
78That said, some project leaders might prefer you work with a specific
79branch. If so, you'll need to visit each submodule directory to checkout
80specific branches. Here, we'll check out the master branch of each submodule:
81
82.. code:: bash
83
84 git submodule foreach 'git checkout master'
85
86You might find that changes upstream have occurred since you cloned the
87submodules. To pull in the latest changes:
88
89.. code:: bash
90
91 git submodule foreach 'git pull'
92
jsseidel436e5712017-09-19 16:51:26 -040093Next, for every submodule, you'll need to rename 'origin' to 'gerrit':
94
95.. code:: bash
96
97 git submodule foreach 'git remote rename origin gerrit'
98
99Finally, for every submodule, you'll have to tell git-review how to find
100Gerrit.
101
102.. code:: bash
103
104 cd doc # Make sure we're in the top level doc repo directory
105 git submodule foreach 'REPO=$(echo $path | sed "s/docs\/submodules\///") ; git remote add gerrit ssh://<LFID>@gerrit.onap.org:29418/$REPO'
106
107Or, if you prefer to do only one at a time:
108
109.. code:: bash
110
111 git remote add gerrit ssh://<LFID>@gerrit.onap.org:29418/repopath/repo.git
112
jsseidel80666192017-09-19 13:29:23 -0400113Requesting Reviews
114------------------
115
116The benefit of working with submodules in this way is that now you can
117make changes, do commits, and request reviews within the submodule
118directory just as if you had cloned the repository in its own directory.
119
120So, you commit as normal, with :code:`git commit -s`, and review as
121normal with :code:`git review`.