danielupton Posted January 13, 2012 Report Share Posted January 13, 2012 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 More sharing options...
manu Posted January 13, 2012 Report Share Posted January 13, 2012 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 More sharing options...
danielupton Posted January 13, 2012 Author Report Share Posted January 13, 2012 Great, thanks Just for interest I ran into a bunch of difficulties developing the driver and have decided that plastic isn't the best tool for the job in this case. So we're gonna use git for deployment.. Don't worry though! we're still gonna use plastic for everything else. Link to comment Share on other sites More sharing options...
manu Posted January 13, 2012 Report Share Posted January 13, 2012 That's a pity!!! Can you tell us that difficulties? Maybe we can help adding some blog post clarifying the dark steps.... Manu Link to comment Share on other sites More sharing options...
danielupton Posted January 16, 2012 Author Report Share Posted January 16, 2012 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 Link to comment Share on other sites More sharing options...
psantosl Posted January 18, 2012 Report Share Posted January 18, 2012 > 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 > 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 Link to comment Share on other sites More sharing options...
danielupton Posted January 18, 2012 Author Report Share Posted January 18, 2012 Hi again.. Sorry i should've been more clear. 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!) you can have a separate "client.conf" Awesome will give that a try! 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 More sharing options...
psantosl Posted January 19, 2012 Report Share Posted January 19, 2012 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 More sharing options...
danielupton Posted January 20, 2012 Author Report Share Posted January 20, 2012 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 More sharing options...
manu Posted January 23, 2012 Report Share Posted January 23, 2012 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! 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 More sharing options...
danielupton Posted January 24, 2012 Author Report Share Posted January 24, 2012 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! 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 More sharing options...
psantosl Posted January 24, 2012 Report Share Posted January 24, 2012 Once you have it, what about blog posting about it? Link to comment Share on other sites More sharing options...
danielupton Posted January 24, 2012 Author Report Share Posted January 24, 2012 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 More sharing options...
manu Posted January 24, 2012 Report Share Posted January 24, 2012 mmmmmmmmm maybe I can share with you a tiny c# project to execute cm commands faster (using our "cm shell"). This project can be executed under UNIX using Mono. I use this project a lot to create small utilities using the cm commands. Link to comment Share on other sites More sharing options...
danielupton Posted January 24, 2012 Author Report Share Posted January 24, 2012 That would be awesome! Link to comment Share on other sites More sharing options...
danielupton Posted January 24, 2012 Author Report Share Posted January 24, 2012 Here's my slow and dirty POC btw! https://github.com/boxofrad/cm-porcelain/blob/master/cm-unified-diff Link to comment Share on other sites More sharing options...
psantosl Posted January 24, 2012 Report Share Posted January 24, 2012 Inside GitHub!!!!!!!!!!! XDDDDDDDDDDDDDDDDDDDDDDD We must share CmdRunner Manu Link to comment Share on other sites More sharing options...
danielupton Posted January 24, 2012 Author Report Share Posted January 24, 2012 Inside GitHub!!!!!!!!!!! XDDDDDDDDDDDDDDDDDDDDDDD Yep thought that'd tickle you 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 Link to comment Share on other sites More sharing options...
manu Posted January 25, 2012 Report Share Posted January 25, 2012 That tool you mentioned would be awesome.. please Here you have a new blog post about the tool and also the source code plus small examples http://codicesoftwar...nner-power.html Link to comment Share on other sites More sharing options...
danielupton Posted January 25, 2012 Author Report Share Posted January 25, 2012 Great! Thanks so much i'll let you know how I get on Link to comment Share on other sites More sharing options...
manu Posted January 25, 2012 Report Share Posted January 25, 2012 On Friday I'm going to publish a new blog post with the source code of our RepliKate tool. This is a real application where the CmdRunner is used massively. Keep tuned! Link to comment Share on other sites More sharing options...
danielupton Posted January 26, 2012 Author Report Share Posted January 26, 2012 Sweet! It now takes about 30seconds.. I think its because a lot of the files are images (binary files). Is there a cm command to get the revision type of a file? Link to comment Share on other sites More sharing options...
manu Posted January 26, 2012 Report Share Posted January 26, 2012 Which was the previous time? yes! you can do it like this: "cm ls c:\wkspaces\code\thirdparty\log4net\log4net.dll --format={2}" Link to comment Share on other sites More sharing options...
danielupton Posted January 26, 2012 Author Report Share Posted January 26, 2012 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! Link to comment Share on other sites More sharing options...
manu Posted January 26, 2012 Report Share Posted January 26, 2012 Coooool Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.