tsrc icon indicating copy to clipboard operation
tsrc copied to clipboard

Sync everything when there are groups

Open vonpupp opened this issue 3 years ago • 2 comments

Hello,

I have the following manifest:

repos:
  - dest: org
    branch: main
    remotes:
    - name: origin
      url: [email protected]:vonpupp-org/org.git
    - name: https
      url: https://vonpupp:<token>@gitlab.com/vonpupp-org/org.git
    - name: nas
      url: ssh://nas/share/repos/gitlab.com:vonpupp-org:org.git
  - dest: org-media
    branch: main
    remotes:
    - name: origin
      url: [email protected]:vonpupp-org/org-media.git
    - name: https
      url: https://vonpupp:<token>@gitlab.com/vonpupp-org/org-media.git
    - name: nas
      url: ssh://nas/share/repos/gitlab.com:vonpupp-org:org-media.git
  - dest: albertdelafuente.com-hugo-refined
    branch: master
    remotes:
    - name: origin
      url: [email protected]:albertdelafuentecom/albertdelafuente.com-hugo-refined.git
    - name: https
      url: https://vonpupp:<token>@gitlab.com/albertdelafuentecom/albertdelafuente.com-hugo-refined.git
    - name: nas
      url: ssh://nas/share/repos/gitlab.com:albertdelafuentecom:albertdelafuente.com-hugo-refined.git


groups:
  default:
    repos: []
  org:
    repos:
      - org
      - org-media

As you can see I have an "org" group which works when I sync with tsrc --verbose sync --group org -r org. Now I just added the last repo and I want to sync everything in the file. I thought of adding as default all the repos, which works, but... as I am adding more and more repos to the manifest I tend to forget to add them to the default group, so they are not part of the sync process.

I tried to use a general regex match like tsrc --verbose sync --group default -r .* but that didn't work. The behavior is "Workspace is empty", which kind of makes sense and kind of doesn't also depending on the point of view.

Possible solutions:

  • tsrc --verbose sync --group default -r .*. Allowing the regular expression . or .*
  • tsrc --verbose sync --group all (being the all name group a reserved name)
  • tsrc --verbose sync --all (a new flag for such purposes)

I hope it makes sense.

vonpupp avatar Jul 04 '22 16:07 vonpupp

I think --group all makes the most sense. We already have the concept of a "default" group.

Remember that we already have '--all-cloned' which does things slightly different than what you need.

Do you want to try and send a patch ?

dmerejkowsky avatar Jul 06 '22 09:07 dmerejkowsky

Sure, I can try to submit a PR probably next week.

I thing --group --all would be better since it is not ambiguous in a scenario of a hypothetical all group existing. Otherwise we would have kind of a recursive situation, which is what brought me here in the first place. Would you agree with --group --all @dmerejkowsky?

vonpupp avatar Jul 07 '22 16:07 vonpupp