Skip to content

Commit a94b9bf

Browse files
[Docs] Updated Subtree Docs
The documentation on subtrees was a bit out of date. The command to update a subtree now requires a message. Added a section on how to push changes from VTR back into the upstream subtree repo. Added a tutorial on how to synchronize libtatum with the Tatum repo.
1 parent f523a0f commit a94b9bf

File tree

1 file changed

+62
-3
lines changed

1 file changed

+62
-3
lines changed

README.developers.md

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ Instead changes should be made in the relevant up-stream repository, and then sy
13301330

13311331
For example to update the `libtatum` subtree:
13321332
```shell
1333-
./dev/external_subtrees.py --update libtatum
1333+
./dev/external_subtrees.py --update libtatum -m "commit message describing why component is being updated"
13341334
```
13351335

13361336
## Adding a new Subtree
@@ -1372,8 +1372,66 @@ To add a new external subtree to VTR do the following:
13721372
This will create two commits to the repository.
13731373
The first will squash all the upstream changes, the second will merge those changes into the current branch.
13741374

1375+
## Pushing VTR Changes Back to Upstream Subtree
13751376

1376-
## Subtree Rational
1377+
If there are changes in the VTR repo in a subtree that should be merged back
1378+
into the source repo of the subtree, the changes can be pushed back manually.
1379+
1380+
The instructions above used a Python script to simplify updating subtrees in
1381+
VTR. This is fine for pulling in changes from a remote repo; however, it is not
1382+
good for pushing changes back. This is because these changes need to be pushed
1383+
somewhere, and it is not a good idea to just push it back to the master branch
1384+
directly. Instead, it should be pushed to a temporary branch. Then a PR can be
1385+
made to bring the changes into the target repo.
1386+
1387+
To push changes VTR made to a subtree do the following:
1388+
1389+
1. Create a fork of the target repo. Optionally you can create a branch to be
1390+
the target of the push, or you can just use master.
1391+
1392+
2. Run:
1393+
```shell
1394+
cd $VTR_ROOT
1395+
git subtree push --prefix=<subtree_path> <forked_repo_url> <branch_name>
1396+
```
1397+
The prefix is the internal path to the subtree, as written in
1398+
`dev/subtree_config.xml`.
1399+
1400+
3. Create a PR from your forked repo to the main repo, sharing the amazing
1401+
changes with the world.
1402+
1403+
## Tutorial: Syncing Tatum with VTR
1404+
1405+
This tutorial will show you how to synchronize `libtatum` in VTR and
1406+
[Tatum](https://github.com/verilog-to-routing/tatum); however, similar steps
1407+
can be done to synchronize any subtree in VTR.
1408+
1409+
First, we will pull in (update) any changes in Tatum that are not in VTR yet.
1410+
On a clean branch (based off master), execute the following:
1411+
```shell
1412+
cd $VTR_ROOT
1413+
./dev/external_subtrees.py --update libtatum -m "Pulling in changes from Tatum."
1414+
```
1415+
If the output in the terminal says `Subtree is already at commit <commit_hash>`,
1416+
then there is nothing to pull in. If it says changes were pulled in, a commit
1417+
would have already been made for you. Push these changes to your branch and
1418+
raise a PR on VTR to merge these changes in.
1419+
1420+
After pulling in all the changes from Tatum, without changing branches, we will
1421+
push our VTR changes to Tatum. This is a bit more complicated since, as stated
1422+
in the section on pushing to subtrees, the changes cannot just be pushed to
1423+
master.
1424+
1425+
Create a fork of Tatum and make sure the master branch of that fork is
1426+
synchronized with Tatum's master branch. Then execute the following:
1427+
```shell
1428+
cd $VTR_ROOT
1429+
git subtree push --prefix=libs/EXTERNAL/libtatum <forked_repo_url> master
1430+
```
1431+
After that command finishes, raise a PR from your forked repo onto the Tatum
1432+
repo for the changes to be reviewed and merged in.
1433+
1434+
## Subtree Rationale
13771435
13781436
VTR uses subtrees to allow easy tracking of upstream dependencies.
13791437
@@ -1469,4 +1527,5 @@ The following outlines the procedure to following when making an official VTR re
14691527
* GitHub will automatically create a release based on the tag
14701528
* Add the new change log entry to the [GitHub release description](https://github.com/verilog-to-routing/vtr-verilog-to-routing/releases)
14711529
* Update the [ReadTheDocs configuration](https://readthedocs.org/projects/vtr/versions/) to build and serve documentation for the relevant tag (e.g. `v8.0.0`)
1472-
* Send a release announcement email to the [vtr-announce](mailto:[email protected]) mailing list (make sure to thank all contributors!)
1530+
* Send a release announcement email to the [vtr-announce](mailto:[email protected]) mailing list (make sure to thank all contributors!)
1531+

0 commit comments

Comments
 (0)