1 ==============================
2 Moving LLVM Projects to GitHub
3 ==============================
5 .. contents:: Table of Contents
12 This is a proposal to move our current revision control system from our own
13 hosted Subversion to GitHub. Below are the financial and technical arguments as
14 to why we are proposing such a move and how people (and validation
15 infrastructure) will continue to work with a Git-based LLVM.
17 There will be a survey pointing at this document which we'll use to gauge the
18 community's reaction and, if we collectively decide to move, the time-frame. Be
19 sure to make your view count.
21 Additionally, we will discuss this during a BoF at the next US LLVM Developer
22 meeting (http://llvm.org/devmtg/2016-11/).
24 What This Proposal is *Not* About
25 =================================
27 Changing the development policy.
29 This proposal relates only to moving the hosting of our source-code repository
30 from SVN hosted on our own servers to Git hosted on GitHub. We are not proposing
31 using GitHub's issue tracker, pull-requests, or code-review.
33 Contributors will continue to earn commit access on demand under the Developer
34 Policy, except that that a GitHub account will be required instead of SVN
35 username/password-hash.
37 Why Git, and Why GitHub?
38 ========================
43 This discussion began because we currently host our own Subversion server
44 and Git mirror on a voluntary basis. The LLVM Foundation sponsors the server and
45 provides limited support, but there is only so much it can do.
47 Volunteers are not sysadmins themselves, but compiler engineers that happen
48 to know a thing or two about hosting servers. We also don't have 24/7 support,
49 and we sometimes wake up to see that continuous integration is broken because
50 the SVN server is either down or unresponsive.
52 We should take advantage of one of the services out there (GitHub, GitLab,
53 and BitBucket, among others) that offer better service (24/7 stability, disk
54 space, Git server, code browsing, forking facilities, etc) for free.
59 Many new coders nowadays start with Git, and a lot of people have never used
60 SVN, CVS, or anything else. Websites like GitHub have changed the landscape
61 of open source contributions, reducing the cost of first contribution and
62 fostering collaboration.
64 Git is also the version control many LLVM developers use. Despite the
65 sources being stored in a SVN server, these developers are already using Git
66 through the Git-SVN integration.
70 * Commit, squash, merge, and fork locally without touching the remote server.
71 * Maintain local branches, enabling multiple threads of development.
72 * Collaborate on these branches (e.g. through your own fork of llvm on GitHub).
73 * Inspect the repository history (blame, log, bisect) without Internet access.
74 * Maintain remote forks and branches on Git hosting services and
75 integrate back to the main repository.
77 In addition, because Git seems to be replacing many OSS projects' version
78 control systems, there are many tools that are built over Git.
79 Future tooling may support Git first (if not only).
84 GitHub, like GitLab and BitBucket, provides free code hosting for open source
85 projects. Any of these could replace the code-hosting infrastructure that we
88 These services also have a dedicated team to monitor, migrate, improve and
89 distribute the contents of the repositories depending on region and load.
91 GitHub has one important advantage over GitLab and
92 BitBucket: it offers read-write **SVN** access to the repository
93 (https://github.com/blog/626-announcing-svn-support).
94 This would enable people to continue working post-migration as though our code
95 were still canonically in an SVN repository.
97 In addition, there are already multiple LLVM mirrors on GitHub, indicating that
98 part of our community has already settled there.
100 On Managing Revision Numbers with Git
101 -------------------------------------
103 The current SVN repository hosts all the LLVM sub-projects alongside each other.
104 A single revision number (e.g. r123456) thus identifies a consistent version of
105 all LLVM sub-projects.
107 Git does not use sequential integer revision number but instead uses a hash to
108 identify each commit.
110 The loss of a sequential integer revision number has been a sticking point in
111 past discussions about Git:
113 - "The 'branch' I most care about is mainline, and losing the ability to say
114 'fixed in r1234' (with some sort of monotonically increasing number) would
115 be a tragic loss." [LattnerRevNum]_
116 - "I like those results sorted by time and the chronology should be obvious, but
117 timestamps are incredibly cumbersome and make it difficult to verify that a
118 given checkout matches a given set of results." [TrickRevNum]_
119 - "There is still the major regression with unreadable version numbers.
120 Given the amount of Bugzilla traffic with 'Fixed in...', that's a
121 non-trivial issue." [JSonnRevNum]_
122 - "Sequential IDs are important for LNT and llvmlab bisection tool." [MatthewsRevNum]_.
124 However, Git can emulate this increasing revision number:
125 ``git rev-list --count <commit-hash>``. This identifier is unique only
126 within a single branch, but this means the tuple `(num, branch-name)` uniquely
129 We can thus use this revision number to ensure that e.g. `clang -v` reports a
130 user-friendly revision number (e.g. `master-12345` or `4.0-5321`), addressing
131 the objections raised above with respect to this aspect of Git.
133 What About Branches and Merges?
134 -------------------------------
136 In contrast to SVN, Git makes branching easy. Git's commit history is
137 represented as a DAG, a departure from SVN's linear history. However, we propose
138 to mandate making merge commits illegal in our canonical Git repository.
140 Unfortunately, GitHub does not support server side hooks to enforce such a
141 policy. We must rely on the community to avoid pushing merge commits.
143 GitHub offers a feature called `Status Checks`: a branch protected by
144 `status checks` requires commits to be whitelisted before the push can happen.
145 We could supply a pre-push hook on the client side that would run and check the
146 history, before whitelisting the commit being pushed [statuschecks]_.
147 However this solution would be somewhat fragile (how do you update a script
148 installed on every developer machine?) and prevents SVN access to the
151 What About Commit Emails?
152 -------------------------
154 We will need a new bot to send emails for each commit. This proposal leaves the
155 email format unchanged besides the commit URL.
157 Straw Man Migration Plan
158 ========================
160 Step #1 : Before The Move
161 -------------------------
163 1. Update docs to mention the move, so people are aware of what is going on.
164 2. Set up a read-only version of the GitHub project, mirroring our current SVN
166 3. Add the required bots to implement the commit emails, as well as the
167 umbrella repository update (if the multirepo is selected) or the read-only
168 Git views for the sub-projects (if the monorepo is selected).
173 4. Update the buildbots to pick up updates and commits from the GitHub
174 repository. Not all bots have to migrate at this point, but it'll help
175 provide infrastructure testing.
176 5. Update Phabricator to pick up commits from the GitHub repository.
177 6. LNT and llvmlab have to be updated: they rely on unique monotonically
178 increasing integer across branch [MatthewsRevNum]_.
179 7. Instruct downstream integrators to pick up commits from the GitHub
181 8. Review and prepare an update for the LLVM documentation.
183 Until this point nothing has changed for developers, it will just
184 boil down to a lot of work for buildbot and other infrastructure
187 The migration will pause here until all dependencies have cleared, and all
188 problems have been solved.
190 Step #3: Write Access Move
191 --------------------------
193 9. Collect developers' GitHub account information, and add them to the project.
194 10. Switch the SVN repository to read-only and allow pushes to the GitHub repository.
195 11. Update the documentation.
196 12. Mirror Git to SVN.
201 13. Archive the SVN repository.
202 14. Update links on the LLVM website pointing to viewvc/klaus/phab etc. to
203 point to GitHub instead.
205 One or Multiple Repositories?
206 =============================
208 There are two major variants for how to structure our Git repository: The
209 "multirepo" and the "monorepo".
214 This variant recommends moving each LLVM sub-project to a separate Git
215 repository. This mimics the existing official read-only Git repositories
216 (e.g., http://llvm.org/git/compiler-rt.git), and creates new canonical
217 repositories for each sub-project.
219 This will allow the individual sub-projects to remain distinct: a
220 developer interested only in compiler-rt can checkout only this repository,
221 build it, and work in isolation of the other sub-projects.
223 A key need is to be able to check out multiple projects (i.e. lldb+clang+llvm or
224 clang+llvm+libcxx for example) at a specific revision.
226 A tuple of revisions (one entry per repository) accurately describes the state
227 across the sub-projects.
228 For example, a given version of clang would be
229 *<LLVM-12345, clang-5432, libcxx-123, etc.>*.
234 To make this more convenient, a separate *umbrella* repository will be
235 provided. This repository will be used for the sole purpose of understanding
236 the sequence in which commits were pushed to the different repositories and to
237 provide a single revision number.
239 This umbrella repository will be read-only and continuously updated
240 to record the above tuple. The proposed form to record this is to use Git
241 [submodules]_, possibly along with a set of scripts to help check out a
242 specific revision of the LLVM distribution.
244 A regular LLVM developer does not need to interact with the umbrella repository
245 -- the individual repositories can be checked out independently -- but you would
246 need to use the umbrella repository to bisect multiple sub-projects at the same
247 time, or to check-out old revisions of LLVM with another sub-project at a
250 This umbrella repository will be updated automatically by a bot (running on
251 notice from a webhook on every push, and periodically) on a per commit basis: a
252 single commit in the umbrella repository would match a single commit in a
258 Downstream SVN users can use the read/write SVN bridges with the following
261 * Be prepared for a one-time change to the upstream revision numbers.
262 * The upstream sub-project revision numbers will no longer be in sync.
264 Downstream Git users can continue without any major changes, with the minor
265 change of upstreaming using `git push` instead of `git svn dcommit`.
267 Git users also have the option of adopting an umbrella repository downstream.
268 The tooling for the upstream umbrella can easily be reused for downstream needs,
269 incorporating extra sub-projects and branching in parallel with sub-project
275 As a preview (disclaimer: this rough prototype, not polished and not
276 representative of the final solution), you can look at the following:
278 * Repository: https://github.com/llvm-beanz/llvm-submodules
279 * Update bot: http://beanz-bot.com:8180/jenkins/job/submodule-update/
284 * Because GitHub does not allow server-side hooks, and because there is no
285 "push timestamp" in Git, the umbrella repository sequence isn't totally
286 exact: commits from different repositories pushed around the same time can
287 appear in different orders. However, we don't expect it to be the common case
288 or to cause serious issues in practice.
289 * You can't have a single cross-projects commit that would update both LLVM and
290 other sub-projects (something that can be achieved now). It would be possible
291 to establish a protocol whereby users add a special token to their commit
292 messages that causes the umbrella repo's updater bot to group all of them
293 into a single revision.
294 * Another option is to group commits that were pushed closely enough together
295 in the umbrella repository. This has the advantage of allowing cross-project
296 commits, and is less sensitive to mis-ordering commits. However, this has the
297 potential to group unrelated commits together, especially if the bot goes
298 down and needs to catch up.
299 * This variant relies on heavier tooling. But the current prototype shows that
300 it is not out-of-reach.
301 * Submodules don't have a good reputation / are complicating the command line.
302 However, in the proposed setup, a regular developer will seldom interact with
303 submodules directly, and certainly never update them.
304 * Refactoring across projects is not friendly: taking some functions from clang
305 to make it part of a utility in libSupport wouldn't carry the history of the
306 code in the llvm repo, preventing recursively applying `git blame` for
307 instance. However, this is not very different than how most people are
308 Interacting with the repository today, by splitting such change in multiple
314 * :ref:`Checkout/Clone a Single Project, without Commit Access <workflow-checkout-commit>`.
315 * :ref:`Checkout/Clone a Single Project, with Commit Access <workflow-multicheckout-nocommit>`.
316 * :ref:`Checkout/Clone Multiple Projects, with Commit Access <workflow-multicheckout-multicommit>`.
317 * :ref:`Commit an API Change in LLVM and Update the Sub-projects <workflow-cross-repo-commit>`.
318 * :ref:`Branching/Stashing/Updating for Local Development or Experiments <workflow-multi-branching>`.
319 * :ref:`Bisecting <workflow-multi-bisecting>`.
324 This variant recommends moving all LLVM sub-projects to a single Git repository,
325 similar to https://github.com/llvm-project/llvm-project.
326 This would mimic an export of the current SVN repository, with each sub-project
327 having its own top-level directory.
328 Not all sub-projects are used for building toolchains. In practice, www/
329 and test-suite/ will probably stay out of the monorepo.
331 Putting all sub-projects in a single checkout makes cross-project refactoring
334 * New sub-projects can be trivially split out for better reuse and/or layering
335 (e.g., to allow libSupport and/or LIT to be used by runtimes without adding a
337 * Changing an API in LLVM and upgrading the sub-projects will always be done in
338 a single commit, designing away a common source of temporary build breakage.
339 * Moving code across sub-project (during refactoring for instance) in a single
340 commit enables accurate `git blame` when tracking code change history.
341 * Tooling based on `git grep` works natively across sub-projects, allowing to
342 easier find refactoring opportunities across projects (for example reusing a
343 datastructure initially in LLDB by moving it into libSupport).
344 * Having all the sources present encourages maintaining the other sub-projects
347 Finally, the monorepo maintains the property of the existing SVN repository that
348 the sub-projects move synchronously, and a single revision number (or commit
349 hash) identifies the state of the development across all projects.
351 .. _build_single_project:
353 Building a single sub-project
354 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
356 Nobody will be forced to build unnecessary projects. The exact structure
357 is TBD, but making it trivial to configure builds for a single sub-project
358 (or a subset of sub-projects) is a hard requirement.
360 As an example, it could look like the following::
362 mkdir build && cd build
363 # Configure only LLVM (default)
364 cmake path/to/monorepo
365 # Configure LLVM and lld
366 cmake path/to/monorepo -DLLVM_ENABLE_PROJECTS=lld
367 # Configure LLVM and clang
368 cmake path/to/monorepo -DLLVM_ENABLE_PROJECTS=clang
372 Read/write sub-project mirrors
373 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
375 With the Monorepo, the existing single-subproject mirrors (e.g.
376 http://llvm.org/git/compiler-rt.git) with git-svn read-write access would
377 continue to be maintained: developers would continue to be able to use the
378 existing single-subproject git repositories as they do today, with *no changes
379 to workflow*. Everything (git fetch, git svn dcommit, etc.) could continue to
380 work identically to how it works today. The monorepo can be set-up such that the
381 SVN revision number matches the SVN revision in the GitHub SVN-bridge.
386 Downstream SVN users can use the read/write SVN bridge. The SVN revision
387 number can be preserved in the monorepo, minimizing the impact.
389 Downstream Git users can continue without any major changes, by using the
390 git-svn mirrors on top of the SVN bridge.
392 Git users can also work upstream with monorepo even if their downstream
393 fork has split repositories. They can apply patches in the appropriate
394 subdirectories of the monorepo using, e.g., `git am --directory=...`, or
395 plain `diff` and `patch`.
397 Alternatively, Git users can migrate their own fork to the monorepo. As a
398 demonstration, we've migrated the "CHERI" fork to the monorepo in two ways:
400 * Using a script that rewrites history (including merges) so that it looks
401 like the fork always lived in the monorepo [LebarCHERI]_. The upside of
402 this is when you check out an old revision, you get a copy of all llvm
403 sub-projects at a consistent revision. (For instance, if it's a clang
404 fork, when you check out an old revision you'll get a consistent version
405 of llvm proper.) The downside is that this changes the fork's commit
408 * Merging the fork into the monorepo [AminiCHERI]_. This preserves the
409 fork's commit hashes, but when you check out an old commit you only get
415 As a preview (disclaimer: this rough prototype, not polished and not
416 representative of the final solution), you can look at the following:
418 * Full Repository: https://github.com/joker-eph/llvm-project
419 * Single sub-project view with *SVN write access* to the full repo:
420 https://github.com/joker-eph/compiler-rt
425 * Using the monolithic repository may add overhead for those contributing to a
426 standalone sub-project, particularly on runtimes like libcxx and compiler-rt
427 that don't rely on LLVM; currently, a fresh clone of libcxx is only 15MB (vs.
428 1GB for the monorepo), and the commit rate of LLVM may cause more frequent
429 `git push` collisions when upstreaming. Affected contributors can continue to
430 use the SVN bridge or the single-subproject Git mirrors with git-svn for
432 * Using the monolithic repository may add overhead for those *integrating* a
433 standalone sub-project, even if they aren't contributing to it, due to the
434 same disk space concern as the point above. The availability of the
435 sub-project Git mirror addresses this, even without SVN access.
436 * Preservation of the existing read/write SVN-based workflows relies on the
437 GitHub SVN bridge, which is an extra dependency. Maintaining this locks us
438 into GitHub and could restrict future workflow changes.
443 * :ref:`Checkout/Clone a Single Project, without Commit Access <workflow-checkout-commit>`.
444 * :ref:`Checkout/Clone a Single Project, with Commit Access <workflow-monocheckout-nocommit>`.
445 * :ref:`Checkout/Clone Multiple Projects, with Commit Access <workflow-monocheckout-multicommit>`.
446 * :ref:`Commit an API Change in LLVM and Update the Sub-projects <workflow-cross-repo-commit>`.
447 * :ref:`Branching/Stashing/Updating for Local Development or Experiments <workflow-mono-branching>`.
448 * :ref:`Bisecting <workflow-mono-bisecting>`.
450 Multi/Mono Hybrid Variant
451 -------------------------
453 This variant recommends moving only the LLVM sub-projects that are *rev-locked*
454 to LLVM into a monorepo (clang, lld, lldb, ...), following the multirepo
455 proposal for the rest. While neither variant recommends combining sub-projects
456 like www/ and test-suite/ (which are completely standalone), this goes further
457 and keeps sub-projects like libcxx and compiler-rt in their own distinct
463 * This has most disadvantages of multirepo and monorepo, without bringing many
465 * Downstream have to upgrade to the monorepo structure, but only partially. So
466 they will keep the infrastructure to integrate the other separate
468 * All projects that use LIT for testing are effectively rev-locked to LLVM.
469 Furthermore, some runtimes (like compiler-rt) are rev-locked with Clang.
470 It's not clear where to draw the lines.
473 Workflow Before/After
474 =====================
476 This section goes through a few examples of workflows, intended to illustrate
477 how end-users or developers would interact with the repository for
480 .. _workflow-checkout-commit:
482 Checkout/Clone a Single Project, without Commit Access
483 ------------------------------------------------------
485 Except the URL, nothing changes. The possibilities today are::
487 svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
489 git clone http://llvm.org/git/llvm.git
491 After the move to GitHub, you would do either::
493 git clone https://github.com/llvm-project/llvm.git
494 # or using the GitHub svn native bridge
495 svn co https://github.com/llvm-project/llvm/trunk
497 The above works for both the monorepo and the multirepo, as we'll maintain the
498 existing read-only views of the individual sub-projects.
500 Checkout/Clone a Single Project, with Commit Access
501 ---------------------------------------------------
508 # direct SVN checkout
509 svn co https://user@llvm.org/svn/llvm-project/llvm/trunk llvm
510 # or using the read-only Git view, with git-svn
511 git clone http://llvm.org/git/llvm.git
513 git svn init https://llvm.org/svn/llvm-project/llvm/trunk --username=<username>
514 git config svn-remote.svn.fetch :refs/remotes/origin/master
515 git svn rebase -l # -l avoids fetching ahead of the git mirror.
517 Commits are performed using `svn commit` or with the sequence `git commit` and
520 .. _workflow-multicheckout-nocommit:
525 With the multirepo variant, nothing changes but the URL, and commits can be
526 performed using `svn commit` or `git commit` and `git push`::
528 git clone https://github.com/llvm/llvm.git llvm
529 # or using the GitHub svn native bridge
530 svn co https://github.com/llvm/llvm/trunk/ llvm
532 .. _workflow-monocheckout-nocommit:
537 With the monorepo variant, there are a few options, depending on your
538 constraints. First, you could just clone the full repository::
540 git clone https://github.com/llvm/llvm-projects.git llvm
541 # or using the GitHub svn native bridge
542 svn co https://github.com/llvm/llvm-projects/trunk/ llvm
544 At this point you have every sub-project (llvm, clang, lld, lldb, ...), which
545 :ref:`doesn't imply you have to build all of them <build_single_project>`. You
546 can still build only compiler-rt for instance. In this way it's not different
547 from someone who would check out all the projects with SVN today.
549 You can commit as normal using `git commit` and `git push` or `svn commit`, and
550 read the history for a single project (`git log libcxx` for example).
552 Secondly, there are a few options to avoid checking out all the sources.
554 **Using the GitHub SVN bridge**
556 The GitHub SVN native bridge allows to checkout a subdirectory directly:
558 svn co https://github.com/llvm/llvm-projects/trunk/compiler-rt compiler-rt —username=...
560 This checks out only compiler-rt and provides commit access using "svn commit",
561 in the same way as it would do today.
563 **Using a Subproject Git Nirror**
565 You can use *git-svn* and one of the sub-project mirrors::
567 # Clone from the single read-only Git repo
568 git clone http://llvm.org/git/llvm.git
570 # Configure the SVN remote and initialize the svn metadata
571 $ git svn init https://github.com/joker-eph/llvm-project/trunk/llvm —username=...
572 git config svn-remote.svn.fetch :refs/remotes/origin/master
575 In this case the repository contains only a single sub-project, and commits can
576 be made using `git svn dcommit`, again exactly as we do today.
578 **Using a Sparse Checkouts**
580 You can hide the other directories using a Git sparse checkout::
582 git config core.sparseCheckout true
583 echo /compiler-rt > .git/info/sparse-checkout
584 git read-tree -mu HEAD
586 The data for all sub-projects is still in your `.git` directory, but in your
587 checkout, you only see `compiler-rt`.
588 Before you push, you'll need to fetch and rebase (`git pull --rebase`) as
591 Note that when you fetch you'll likely pull in changes to sub-projects you don't
592 care about. If you are using spasre checkout, the files from other projects
593 won't appear on your disk. The only effect is that your commit hash changes.
595 You can check whether the changes in the last fetch are relevant to your commit
598 git log origin/master@{1}..origin/master -- libcxx
600 This command can be hidden in a script so that `git llvmpush` would perform all
601 these steps, fail only if such a dependent change exists, and show immediately
602 the change that prevented the push. An immediate repeat of the command would
603 (almost) certainly result in a successful push.
604 Note that today with SVN or git-svn, this step is not possible since the
605 "rebase" implicitly happens while committing (unless a conflict occurs).
607 Checkout/Clone Multiple Projects, with Commit Access
608 ----------------------------------------------------
610 Let's look how to assemble llvm+clang+libcxx at a given revision.
617 svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm -r $REVISION
619 svn co http://llvm.org/svn/llvm-project/clang/trunk clang -r $REVISION
621 svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx -r $REVISION
625 git clone http://llvm.org/git/llvm.git
627 git svn init https://llvm.org/svn/llvm-project/llvm/trunk --username=<username>
628 git config svn-remote.svn.fetch :refs/remotes/origin/master
630 git checkout `git svn find-rev -B r258109`
632 git clone http://llvm.org/git/clang.git
634 git svn init https://llvm.org/svn/llvm-project/clang/trunk --username=<username>
635 git config svn-remote.svn.fetch :refs/remotes/origin/master
637 git checkout `git svn find-rev -B r258109`
639 git clone http://llvm.org/git/libcxx.git
641 git svn init https://llvm.org/svn/llvm-project/libcxx/trunk --username=<username>
642 git config svn-remote.svn.fetch :refs/remotes/origin/master
644 git checkout `git svn find-rev -B r258109`
646 Note that the list would be longer with more sub-projects.
648 .. _workflow-multicheckout-multicommit:
653 With the multirepo variant, the umbrella repository will be used. This is
654 where the mapping from a single revision number to the individual repositories
655 revisions is stored.::
657 git clone https://github.com/llvm-beanz/llvm-submodules
659 git checkout $REVISION
661 git submodule update clang llvm libcxx
662 # the list of sub-project is optional, `git submodule update` would get them all.
664 At this point the clang, llvm, and libcxx individual repositories are cloned
665 and stored alongside each other. There are CMake flags to describe the directory
666 structure; alternatively, you can just symlink `clang` to `llvm/tools/clang`,
669 Another option is to checkout repositories based on the commit timestamp::
671 git checkout `git rev-list -n 1 --before="2009-07-27 13:37" master`
673 .. _workflow-monocheckout-multicommit:
678 The repository contains natively the source for every sub-projects at the right
679 revision, which makes this straightforward::
681 git clone https://github.com/llvm/llvm-projects.git llvm-projects
683 git checkout $REVISION
685 As before, at this point clang, llvm, and libcxx are stored in directories
686 alongside each other.
688 .. _workflow-cross-repo-commit:
690 Commit an API Change in LLVM and Update the Sub-projects
691 --------------------------------------------------------
693 Today this is possible, even though not common (at least not documented) for
694 subversion users and for git-svn users. For example, few Git users try to update
695 LLD or Clang in the same commit as they change an LLVM API.
697 The multirepo variant does not address this: one would have to commit and push
698 separately in every individual repository. It would be possible to establish a
699 protocol whereby users add a special token to their commit messages that causes
700 the umbrella repo's updater bot to group all of them into a single revision.
702 The monorepo variant handles this natively.
704 Branching/Stashing/Updating for Local Development or Experiments
705 ----------------------------------------------------------------
710 SVN does not allow this use case, but developers that are currently using
711 git-svn can do it. Let's look in practice what it means when dealing with
712 multiple sub-projects.
714 To update the repository to tip of trunk::
719 cd ../../projects/libcxx
722 To create a new branch::
724 git checkout -b MyBranch
726 git checkout -b MyBranch
727 cd ../../projects/libcxx
728 git checkout -b MyBranch
732 git checkout AnotherBranch
734 git checkout AnotherBranch
735 cd ../../projects/libcxx
736 git checkout AnotherBranch
738 .. _workflow-multi-branching:
743 The multirepo works the same as the current Git workflow: every command needs
744 to be applied to each of the individual repositories.
745 However, the umbrella repository makes this easy using `git submodule foreach`
746 to replicate a command on all the individual repositories (or submodules
749 To create a new branch::
751 git submodule foreach git checkout -b MyBranch
755 git submodule foreach git checkout AnotherBranch
757 .. _workflow-mono-branching:
762 Regular Git commands are sufficient, because everything is in a single
765 To update the repository to tip of trunk::
769 To create a new branch::
771 git checkout -b MyBranch
775 git checkout AnotherBranch
780 Assuming a developer is looking for a bug in clang (or lld, or lldb, ...).
785 SVN does not have builtin bisection support, but the single revision across
786 sub-projects makes it possible to script around.
788 Using the existing Git read-only view of the repositories, it is possible to use
789 the native Git bisection script over the llvm repository, and use some scripting
790 to synchronize the clang repository to match the llvm revision.
792 .. _workflow-multi-bisecting:
797 With the multi-repositories variant, the cross-repository synchronization is
798 achieved using the umbrella repository. This repository contains only
799 submodules for the other sub-projects. The native Git bisection can be used on
800 the umbrella repository directly. A subtlety is that the bisect script itself
801 needs to make sure the submodules are updated accordingly.
803 For example, to find which commit introduces a regression where clang-3.9
804 crashes but not clang-3.8 passes, one should be able to simply do::
806 git bisect start release_39 release_38
807 git bisect run ./bisect_script.sh
809 With the `bisect_script.sh` script being::
812 cd $UMBRELLA_DIRECTORY
813 git submodule update llvm clang libcxx #....
816 ninja clang || exit 125 # an exit code of 125 asks "git bisect"
817 # to "skip" the current commit
819 ./bin/clang some_crash_test.cpp
821 When the `git bisect run` command returns, the umbrella repository is set to
822 the state where the regression is introduced. The commit diff in the umbrella
823 indicate which submodule was updated, and the last commit in this sub-projects
824 is the one that the bisect found.
826 .. _workflow-mono-bisecting:
831 Bisecting on the monorepo is straightforward, and very similar to the above,
832 except that the bisection script does not need to include the
833 `git submodule update` step.
835 The same example, finding which commit introduces a regression where clang-3.9
836 crashes but not clang-3.8 passes, will look like::
838 git bisect start release_39 release_38
839 git bisect run ./bisect_script.sh
841 With the `bisect_script.sh` script being::
846 ninja clang || exit 125 # an exit code of 125 asks "git bisect"
847 # to "skip" the current commit
849 ./bin/clang some_crash_test.cpp
851 Also, since the monorepo handles commits update across multiple projects, you're
852 less like to encounter a build failure where a commit change an API in LLVM and
853 another later one "fixes" the build in clang.
859 .. [LattnerRevNum] Chris Lattner, http://lists.llvm.org/pipermail/llvm-dev/2011-July/041739.html
860 .. [TrickRevNum] Andrew Trick, http://lists.llvm.org/pipermail/llvm-dev/2011-July/041721.html
861 .. [JSonnRevNum] Joerg Sonnenberg, http://lists.llvm.org/pipermail/llvm-dev/2011-July/041688.html
862 .. [MatthewsRevNum] Chris Matthews, http://lists.llvm.org/pipermail/cfe-dev/2016-July/049886.html
863 .. [submodules] Git submodules, https://git-scm.com/book/en/v2/Git-Tools-Submodules)
864 .. [statuschecks] GitHub status-checks, https://help.github.com/articles/about-required-status-checks/
865 .. [LebarCHERI] Port *CHERI* to a single repository rewriting history, http://lists.llvm.org/pipermail/llvm-dev/2016-July/102787.html
866 .. [AminiCHERI] Port *CHERI* to a single repository preserving history, http://lists.llvm.org/pipermail/llvm-dev/2016-July/102804.html