tsrc icon indicating copy to clipboard operation
tsrc copied to clipboard

tsrc generate a manifest of current sha1 or branches

Open arnaudgelas opened this issue 8 years ago • 6 comments

Given the current config of all repositories, I would like to create a manifest made of sha1 or made of current branches...

Right now, is it possible to do so?

If not, I guess it should not be complicated to do such a feature, but I am not really sure how users would call it?

arnaudgelas avatar Oct 06 '17 16:10 arnaudgelas

Well, we could call it 'snapshot'.

You could run tsrc snapshot -o snapshot.yml

It would generate a file looking like:

# just an integer we can bump if we change our mind about the syntax
format: 1

repos:
   - src: foo
     url: [email protected]:foo
     branch: master
     sha1: abfe123   
     # optional: commit message and author ?
  - src: bar
    ...

manifest:
   url: [email protected]:manifest
   branch: master
   sha1: 124bef6

And then later on you could run:

$ tsrc reset --snapshot /path/to/snapshot

dmerejkowsky avatar Oct 09 '17 08:10 dmerejkowsky

Regarding the format, if you want to add one integer in the yml, it should also appear in the manifest.yml provided to start/init with, right?

snapshot sounds great!

How about:

  • tsrc snapshot -b which would by default make a snapshot to replace manifest.yml with branches to te tracked?
  • tsrc snapshot -b -m /path/snapshot.yml it would save to a given file with branches to be tracked?
  • tsrc snapshot -c -m /path/snapshot.yml it would save to a given file with only sha1?
  • tsrc snapshot -b -c -m /path/snapshot.yml it would save to a given file with branch and sha1? (Although this one does not make much sense since you would checkout a sha1 which could be on any branch)

I like tsrc reset and tsrc reset --snapshot, but also it would be great to be able to init from a given snapshot file:

$ tsrc init <url> -m snapshot.yml
$ tsrc init -m /path/to/snapshot.yml 

And if we could log/diff from a given snapshot.

I have just realized that it is also linked to the groups you have checked out/cloned locally...

What do you think?

arnaudgelas avatar Oct 09 '17 19:10 arnaudgelas

I'm not sure I understand the difference between tsrc snapshot -b and tsrc snapshot -b -m. Could you elaborate ?

Otherwise, all of this looks like nice features to have, but I'm afraid the CLI is going to become quite complicated if we are not careful.

I think the best way to move forward is to list all the use cases and look for generic solutions that can satisfy them.

dmerejkowsky avatar Oct 10 '17 08:10 dmerejkowsky

If you do not specify any manifest file by the means of -m, (i.e. by default) it will replace the default one (which is supposed to be .tsrc/manifest/manifest.yml?)

arnaudgelas avatar Oct 10 '17 14:10 arnaudgelas

Oh I see. Thanks for the clarification

dmerejkowsky avatar Oct 10 '17 15:10 dmerejkowsky

I'm quite interested in implementing this. Is there anyone else here interesting collaborating or dog-fooding?

Our specific use-case is building a release from a snapshot.yaml in a manner that is completely reproducable in future. Subsequent releases can simply reset to the snapshot and advance relevant repos forward. Our preference is not to pollute all the repos with product-specific tags.

nigels-com avatar Jun 14 '23 00:06 nigels-com