Jump to content

Plastic equivilent to HEAD?


danielupton

Recommended Posts

Hi,

I'm considering writing an open source driver to use the Capistrano deployment tool with Plastic SCM,

The current drivers (for git and the like) use the concept of "HEAD"..

Which in other version control systems means something like the latest changeset on the current branch or the changeset currently checked out.

Does Plastic SCM have an equivalent?

I dont have a lot of experience using the Plastic CLI so the closest i could come up with is:

cm status | head -n1 | awk -F ':' '{print $2}' | awk -F '@' '{print $1}'

This extracts the changeset number from the status command

Thanks!

- Daniel

Link to comment
Share on other sites

Hello Daniel!

we are going to create a task in order to be able to get that info using the "cm find" command.

Until then you can use the following: (With advanced permissions granted)

cm q "select ichangesetid from branch where sname='YourBranchName'"

This changeset will be the HEAD of the branch :)

Link to comment
Share on other sites

Okay :)

One thing i was unsure on was how to do a command line diff of the contents of 2 changesets.

This needs to be executed both on our production (ubuntu) server (entirely text based) and each developers machine.

Running diff from the command line on my dev machine attempts to start the GUI diff tool.

Can you specify a diff tool for a one-time diff? (as in not change any client settings)

Ultimately my gut feel was that repositories seem a lot "cheaper" in git as you do not have a server component per se.

Also the git driver for capistrano is already mature and it would be hard to justify the time cost of maintaining a driver of our own when we need to be fully focused on our product.

Do you guys have any plans of implementing Capistrano support any time soon?

Thanks :D

Link to comment
Share on other sites

> One thing i was unsure on was how to do a command line diff of the contents of 2 changesets.

cm diff cs:4 cs:5

:P

> Can you specify a diff tool for a one-time diff? (as in not change any client settings)

you can have a separate "client.conf" and run

cm diff blahblah -clientconf=yourtextbasedclient.conf

> Ultimately my gut feel was that repositories seem a lot "cheaper" in git as you do not have a server component per se.

Uhm... it is a gut feel... I guess I can only change it when your T-Shirts arrive :P

Link to comment
Share on other sites

Hi again..

Sorry i should've been more clear. :P

I mean a "full" diff (including file contents).

Ala git:

git diff f04ecedd..9004ee03

@@ -1,7 +1,7 @@

-echo 'foo'
+echo 'foobar'

Sorry (probably a silly question!) :P

you can have a separate "client.conf"

Awesome will give that a try! :D

Uhm... it is a gut feel... I guess I can only change it when your T-Shirts arrive

YES!! sitting here shivering in the skin tight glee t-shirt my mom bought me because i've nothing else to wear!

Link to comment
Share on other sites

See what you mean...

Right now you'll need some scripting. We don't have a text based diff.

You could easily script our diff + diffing the files (using cm cat to download contents). Easy but a little bit of work.

We will try to catch up with this, but for the time being, maybe it is better if you script it and count on our help to make it work.

T-Shirts??? I promised them and they'll get there, we just had some issues with the provider and we're so overloaded of work that it is not in the top prio, but I had a promise from the guy on top of it that you'll get them before the end of the month... I'm soooo sorry. :'(

Link to comment
Share on other sites

Right now you'll need some scripting. We don't have a text based diff.

You could easily script our diff + diffing the files (using cm cat to download contents). Easy but a little bit of work.

Yep thats what i was thinking :)

The only thing im unsure of is how do you 'cat' a file as it is in a specified changeset?

(my confusion comes from how 'changeset' and 'revsion' are seperate entities and the cat command takes a revision number)

Sorry its probably a bit of a silly question!

But say I have the file "my_thing.rb" how would i say "give me my_thing.rb as it was in changeset 20 regardless of whether or not it was changed in that changeset"

T-Shirts??? I promised them and they'll get there, we just had some issues with the provider and we're so overloaded of work that it is not in the top prio, but I had a promise from the guy on top of it that you'll get them before the end of the month... I'm soooo sorry. :'(

No problem, just messin with ya ;)

Link to comment
Share on other sites

Sorry its probably a bit of a silly question!

But say I have the file "my_thing.rb" how would i say "give me my_thing.rb as it was in changeset 20 regardless of whether or not it was changed in that changeset"

Not silly! I've had to look into the code to answer you! :P

You can do it by "cm cat Path\To\my_thing.rb#cs:20"

It will return to you the content of the file regardless of whether or not it was changed on that changeset. There is a modifier called "--file=tmp.txt" if you want to save the content into a external file.

Manu.

Link to comment
Share on other sites

Awesome thanks!

Glue that together with some unix file descriptor magic and you've got:

diff -u <(cm cat 'app/models/some_model.rb#cs:20') <(cm cat 'app/models/some_model.rb')

Thats the kind of diff i was looking for thanks! :D

Would be nice to have it built into plastic, but for now i'm happy with writing my own custom "porcelain" scripts to automate it.

Link to comment
Share on other sites

Yep will do for sure :)

So far the proof of concept works but is SLOOOOOOW when you have a lot of files!

time ../../cm-porcelain/cm-unified-diff 50 59


27.23s user 2.67s system 50% cpu 59.378 total

This is with about 50 files (added, changed, deleted etc..) (on an Quad i7 MBP with 8GB DDR3)

It diffs against /dev/null when files are added / deleted.

Link to comment
Share on other sites

Inside GitHub!!!!!!!!!!!

XDDDDDDDDDDDDDDDDDDDDDDD

Yep thought that'd tickle you :P

Until theres a 'plastic hub' im afraid they've got the edge over you there.

We're now looking at using deployinator to wrap our deployments, one work around would be to write the diff to a cache file as part of the build process but that feels a bit sticky.

That tool you mentioned would be awesome.. please :D

Link to comment
Share on other sites

Great thanks..

It was originally 59 seconds.

Ignoring all binary files completely cuts it down to about 12 seconds which is about what i'd expect to see.

The biggest bottleneck now is probably the network latency (we are using a central plastic server, instead of a DVCS model).

But that should be much quicker when its run on the build server as it'll be on the same LAN.

Thanks for your help! :D

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...