tsrc
tsrc copied to clipboard
Documentation concerning tsrc apply-manifest
Environment
- Output of
tsrc version: 2.5.0 - Operating system: Linux 64 debian
Hi ! Close question to this topic https://github.com/dmerejkowsky/tsrc/issues/279
The documentation could be updated to clarify the following incertitude. I was questioning myself concerning https://dmerejkowsky.github.io/tsrc/guide/manifest/ with sections "Using the apply-manifest command to avoid breaking developers' workflow" and "Additional notes".
Is:
It is common to place the manifest repo itself in the manifest - so it's easy to edit or read
(described in Additional notes)
Compatible with this command:
cd /path/to/work # holding .tsrc refering to manifest/manifest.yml
tsrc apply-manifest manifest/manifest.yml
? (described in Using the apply-manifest command to avoid breaking developers' workflow
In other way: is the command tsrc apply-manifest works fine when the git repository holding the manifest is inside the workspace installed by tsrc init ?
The answer seems to be yes, but this is not obvious because manifest/manifest.yml is dirty iand it will update .tsrc/xxx/manifest.yml which will try to update manifest/manifest.yml (but since dirty tsrc will not try to update ... or failed).
I tried two things:
- I added new git repos in the manifest/manifest.yml: they were added.
- But today I wanted to remove
branch: dev-fooand calltsrc apply-manifest manifest/manifest.ymlno error but tsrc did not switch to the branch to master. Not sure why !
The workflow looks like this. Say you want to add a new repo, named bar and you already have:
repos:
- url: [email protected]:dmerejkowsky/foo.git
dest: foo
- url: [email protected]:dmerejkowsky/dummy-manifest.git
dest: manifest
- Run
tsrc initso that 'foo' and 'manifest' are cloned in their respective folders - Edit the file in
<workspace>/manifest/manifest.ymlto add the new repo:
- url: [email protected]:dmerejkowsky/foo.git
dest: foo
+
+ - url: [email protected]:dmerejkowsky/bar.git
+ dest: bar
- Run
tsrc apply-manifest <workspace/manifest/manifest.ymlto make sure your changes are correct - Create a commit with your changes in the manifest repo
- Push the commit into a branch in the manifest, say
add-bar - Make someone review the changes
- Merge the
add-barbranch into the master branch of the manifest - Run
tsrc sync. - The repo in
.tsc/manifestis updated - Since 'bar' was already cloned when you ran
apply-manifestno new repo is cloned - The repo in
manifest/manifestis not updated because it's on the branchadd-barand it should be onmaster - You can then manually run
cd <workspace>/manifest ; git checkout master
tsrc did not switch to the branch to master. Not sure why !
That's expected. See the relevant documentation
@dmerejkowsky thank you for confirming that we can call apply-manifest inside the workspace but not necessary have to be applied from a manifest outside the workspace. The documentation was unclear on this point and you should include your example to remove any confusion.
Sorry for my poor English. In fact, I wanted to say that I tried two different things:
First thing:
Inital workspace/manifest/manifest.yml:
repos:
- url: [email protected]:dmerejkowsky/foo.git
dest: foo
If I add a new repo bar:
repos:
- url: [email protected]:dmerejkowsky/foo.git
dest: foo
- url: [email protected]:dmerejkowsky/bar.git
dest: bar
The command tsrc apply-manifest workspace/manifest/manifest.yml will git clone the bar/ repo.
Ok so far so good :) but :
Second thing:
Inital workspace/manifest/manifest.yml. Initial repo (repo foo with branch dev-foo):
repos:
- url: [email protected]:dmerejkowsky/foo.git
branch: dev-foo
dest: foo
Change the branch of repo foo to follow master:
repos:
- url: [email protected]:dmerejkowsky/foo.git
dest: foo
The foo repo is not dirty ! Even if I commit (or not) workspace/manifest/manifest.yml in local (your step 3.) when I call tsrc apply-manifest workspace/manifest/manifest.yml the branch is not switched. Do you consider that I'm on the case described by your documentation in case the repository is on an incorrect branch, the fast-forward merge will still be attempted, but an error message will be show in the end because tsrc does not print error (echo $? is 0) and there is no possible conflict because the repo is clean and the switch to the branch is possible (git checkout works). But it stays to the dev-foo branch.