This topic contains 21 replies, has 3 voices, and was last updated by amcgrane 9 years, 2 months ago.
Getting Milestone Comments in Translator
-
amcgrane
Interesting! I am writing something similar although I am targeting a GIT repository.
Is it just for back up purposes? Or would you like to be able to deploy from your TFS server?Alan is your feed into TFS just for back up purposes? Jonathan is working on some scripts which can be used to go the other way in terms of taking exported projects and re-inserting them into another Iguana instance.
Regarding getting the milestone information – vcs_repo.sqlite is a fossil repository. We ship the fossil executable with Iguana in the main directory.
If you do fossil ui vcs_repo.sqlite you’ll get an idea of how the repository is laid out and how the milestones are implemented. See what you think. Happy to answer more questions as you dig into it.
fossil status etc. are various commands which will give output you can process.
If we were to create an API to get access to the milestone comments, what type of API would you like?
i.e.
http://my-iguana:6543/mapper/milestones?guid=E7ABC72347237373737373
Could return a JSON array with each entry having:
- Milestone name
- User – the one that made the commit
- Timestamp
- Changeset GUID from fossil
Would that be enough or do you need additional information like the currently selected milestone?
just for back up purposes? Or would you like to be able to deploy from your TFS server?
Alan is your feed into TFS just for back up purposes? Jonathan is working on some scripts which can be used to go the other way in terms of taking exported projects and re-inserting them into another Iguana instance.
Regarding getting the milestone information – vcs_repo.sqlite is a fossil repository. We ship the fossil executable with Iguana in the main directory.
If you do fossil ui vcs_repo.sqlite you’ll get an idea of how the repository is laid out and how the milestones are implemented. See what you think. Happy to answer more questions as you dig into it.
fossil status etc. are various commands which will give output you can process.Hi Eliot/Jonathan,
Yes, it is just for backup purposes right now. I am currently taking an export of each channel once a milestone has been saved, zipping them up, sending them on via sftp every night, downloading them locally, splitting them out, and inserting them into TFS using a C# command line project I wrote.
I used the fossil ui vcs_repo.sqlite command before, and can get the info contained in Edit\Admin (and the other directories fossil produces like ) in the working directory of Iguana. However, I can’t seem to find the detailed information contained in ‘Timeline Items’ that the fossil UI is producing with the milestone comments and previous versions etc. I’m getting access to vcs_repo.sqlite and parsing it into Lua tables, so I was wondering if the timeline items are stored in one of the tables in there? Or is it possible to use a fossil command that returns the fossil into a Lua table in Iguana or something? If it were necessary, I could even save the command line output to a temporary file and read it into Iguana, but that seems a little hacky.
If we were to create an API to get access to the milestone comments, what type of API would you like?
i.e.
http://my-iguana:6543/mapper/milestones?guid=E7ABC72347237373737373
Could return a JSON array with each entry having:- Milestone name
- User – the one that made the commit
- Timestamp
- Changeset GUID from fossil
Would that be enough or do you need additional information like the currently selected milestone?
For my current purposes I wouldn’t need the currently selected milestone…that would be a very fine level of detail right now, but would be something we would be interested in in the future.
I think basically, the information I need would be exactly what the fossil timeline shows:
2014-03-05
17:33 [7bcca74169] user: admin, tags: trunk,__AA6DC5CA4434550E3AD45ABA0DF13120__ Milestone 270 – Updated coding standards in mainThe date and time, the user, the guid, and the milestone number with the comments about the milestone (the name).
Thanks,
Alan.The GUID you see there is the unique GUID that identifies the translator instance. It should be an easy enough API to put together.
So this is one potential interface:
http://localhost:8081/milestone_info?translator_guid=BD2F7083D46E4A06BF43593BCC5B20D6&pretty=true
[
{
“comment”: “Authenticate everyone”,
“id”: “7f8efecfa25d69e88935690e85305496552120a1”,
“ts”: “2014-01-25 14:27:00”,
“user”: “admin”
},
{
“comment”: “More logging”,
“id”: “cc9091c4001cc6da3af219f2ac3db1405c9b87f8”,
“ts”: “2014-01-22 14:57:39”,
“user”: “admin”
},
{
“comment”: “Put logging in”,
“id”: “7ce5c7fe4edb4d875c46173d2a9f73d6d252d6e7”,
“ts”: “2014-01-22 14:54:58”,
“user”: “admin”
},
{
“comment”: “Put in some echo logic.”,
“id”: “a9d8827768c442d0974eecc38ddbcefafc135b99”,
“ts”: “2014-01-22 14:52:01”,
“user”: “admin”
},
{
“comment”: “Comment out ml.recordId”,
“id”: “bc0e403d0579d73d2b876cf31657a66f4c23926d”,
“ts”: “2014-01-22 14:17:45”,
“user”: “admin”
},
{
“comment”: “Commit”,
“id”: “ec02f94161fbeebea037697beabac8e6262c4a6d”,
“ts”: “2014-01-22 14:17:19”,
“user”: “admin”
},
{
“comment”: “First commit”,
“id”: “9a4b1c919fb554ad4c09cacd5f70b12353523c88”,
“ts”: “2014-01-21 13:00:12”,
“user”: “admin”
},
{
“comment”: “No milestone defined.”,
“id”: “ebca230e996dd72bab245381be9456284d4608a6”,
“ts”: “2014-01-21 12:59:42”,
“user”: “admin”
}
]Fantastic! That looks like it would be a Json table returned? It’s exactly what we were looking for anyway.
Is it a single call to return all channel info, or pass the channel Guid and the returned table is the info for that channel?Alan.
Yes it’s a JSON array which is returned. The parameter translator_guid refers to the GUID of the translator instance. A channel also has a GUID but one channel could have multiple translator instances. i.e. if you had:
From Translator –> Translator Filter –> To Translator
Then there would be three translator instances.
I just have to see where the information is stored stating the configured milestone for a translator instance.
So there is a milestone attribute in IguanaConfiguration.xml like this:
<from_http
type="mapper"
guid="BD2F7083D46E4A06BF43593BCC5B20D6"
use_most_recent_milestone="false"
milestone="More logging"
mapper_url_path="test"/>Which gives one access to the information of what the configured milestone is for a given channel. One can get that from the channel API. So I think this API is complete in that it gives all the information required.
The only thing up for debate is whether the choice of “translator_guid” and the property names are good. It would be best to make the API consistent with other parts of Iguana’s web API.
Hmm, I did check that and it was empty for all my channels, whereas in the ‘event’ table in ‘vcs_repo.sqlite’ you can see all the data.
We could use “milestone” in the JSON instead of “comment” for consistency with IguanaConfiguration.xml terminology.
ts for “timestamp” has pros/cons – smaller over the wire. More cryptic although the context makes it clear what it is for. Any feedback welcome.
If one has
use_most_recent_milestone = true
Then the milestone attribute will not appear.
“Milestone” would definitely be clearer than “Comment”. Why would it only be populated when a previous milestone is selected though? I would have imagined it would contain the information of whatever milestone is being used; whether it is the most recent or not.
“ts” is fine, as one look at the contents will let you know what it is….although the difference between “ts” and “timestamp” would be nominal I would have thought?
We’re going for milestone.
ts vs. timestamp, 7 bytes less per entry. Every byte is sacred 😉
We should have it patched into the nightly snapshot for the next 5.6.4 release of Iguana so you can try out the API once it’s in there and built.
You must be logged in to reply to this topic.