Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation concerning tsrc apply-manifest #336

Open
Lecrapouille opened this issue Jan 16, 2022 · 2 comments
Open

Documentation concerning tsrc apply-manifest #336

Lecrapouille opened this issue Jan 16, 2022 · 2 comments

Comments

@Lecrapouille
Copy link
Contributor

Lecrapouille commented Jan 16, 2022

Environment

  • Output of tsrc version: 2.5.0
  • Operating system: Linux 64 debian

Hi ! Close question to this topic #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-foo and call tsrc apply-manifest manifest/manifest.yml no error but tsrc did not switch to the branch to master. Not sure why !
@dmerejkowsky
Copy link
Collaborator

dmerejkowsky commented Jan 17, 2022

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
  1. Run tsrc init so that 'foo' and 'manifest' are cloned in their respective folders
  2. Edit the file in<workspace>/manifest/manifest.yml to add the new repo:
  - url: [email protected]:dmerejkowsky/foo.git
    dest: foo
+
+  - url: [email protected]:dmerejkowsky/bar.git
+    dest: bar
  1. Run tsrc apply-manifest <workspace/manifest/manifest.yml to make sure your changes are correct
  2. Create a commit with your changes in the manifest repo
  3. Push the commit into a branch in the manifest, say add-bar
  4. Make someone review the changes
  5. Merge the add-bar branch into the master branch of the manifest
  6. Run tsrc sync.
  7. The repo in .tsc/manifest is updated
  8. Since 'bar' was already cloned when you ran apply-manifest no new repo is cloned
  9. The repo in manifest/manifest is not updated because it's on the branch add-bar and it should be on master
  10. 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

@Lecrapouille
Copy link
Contributor Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants