The task cycle continued

Now you have an initial repository to play with, so you can start to make changes.

The two workflows I'm going to describe here will vary slightly if you're working with one of the plugins for the supported IDEs (remember: Visual Studio, IntellIJ, Eclipse…) since they'll take care of the "check out / check in" cycle themselves.

IMPORTANT: Check-outs are not locks!

Before describing any workflow patterns, let me explain what a check-out is in Plastic.

A check-out in Plastic is NOT a "check out" in Subversion or CVS.

Let me make this very clear to avoid further confusion. When you do a "check out" in SVN or CVS, what you're doing is downloading code from the remote repository into your machine. This is a very different operation in Plastic.  In fact, with Plastic (like in ClearCase, Perforce, SourceSafe and most of the commercial systems) the closest operation would be an update.

So, what is a check-out in Plastic?

Check-out means: I'm going to modify this file.

FAQ: While I have a file checked out, does that mean no one else can check it out?

ANSWER: No, it doesn't mean that, it just means: "Hey Plastic, I'm modifying this file, ok?"

FAQ: So does the server know about check-outs?

ANSWER: No, not unless it is an exclusive check-out.

FAQ: Why do you guys even use check-outs at all??

ANSWER: Well, with Plastic, you can avoid them entirely if you want. (I'll explain how later.) Some users, however, will prefer to tell Plastic they're working on something. Why? In a situation where you have a large codebase, it will unfortunately take Plastic a long time to automatically scan your entire workspace for changes. If you perform check-outs along with check-ins, then you're telling Plastic which files you've modified, so it doesn't take forever and a day to update. Also be aware that plugins like Visual Studio (compatible with SCC) do need to run the check-out cycle, but like I said, Plastic does this easily.

Change / check-in workflow

Do you want to work with Plastic in the same way you would with Subversion or CVS? Meaning, of course, that you just change code on your workspace and later you check in. Yep, it's as simple as that. You can edit files without needing to do an explicit check-out.

In order to do so, simply modify the files you need. Then you can use the Pending changes tool in the Plastic GUI to automatically identify the modified files. Plastic SCM also recognizes when you have moved files around, even if the files' content has been modified.

Note: Take into account that by default Plastic will write all the files as read-only. We do this to enforce the check-out / check-in cycle. If you want to overwrite files with the read-only flag set, you'll need an editor capable of modifying read-only files. Notepad, for instance, can't. You can always configure Plastic so that it doesn't leave the files as read-only. In order to do so, go to Preferences, click on the Other options section and uncheck Update and Checkin operations set files as read-only.

Check-out / change / check-in workflow

This is the default cycle and the one you'll use while working with the plug-ins on your favorite IDE.

If you're working from the GUI, checking out a file is very simple: just right click on it and select check out for edit. Shortcut: press CTRL+O to checkout.

Then, modify the file. Finally, go to the Pending changes view to check it in. Thus completes the check-out / change / check-in workflow.

As you can see in the figure above, the Pending changes view is able to display check-outs and changed files together, so you could even use a mixed workflow where you check out some files and you simply overwrite others.

Reviewing changes

Once you've modified your first files, go to the Pending changes view and click on Show diffs to review the changes before checking them in.

There are many places in Plastic where you'll be able to review changes too. You can compare the changes made in branches or changesets, or compare what changed between two labels, branches, changesets, or revisions.

Finish the check-in and go to the Branch Explorer. From there, you'll be able to inspect the last changeset you've created just by double-clicking the changeset or right-clicking on it and selecting Diff changeset contents.