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