Quick Start
***********

Now that you have Pastwatch installed and setup, you're probably excited to get started using it.

To get started, just create a project with one user.  In this example, the project name is testproject and the user's name is Alex:

          yipal% pastctl create testproject
          sfscd not running, limiting sources of entropy
          Creating new key: project.key.57449#1 (Rabin)
                 Key Label: testproject
          wrote key: /tmp/project.key.57449
          new project ID: yvQocoVj1Sxd9HrWZFSly+AczFM

          yipal% pastctl join Alex testproject
          sfscd not running, limiting sources of entropy
          Creating new key: member.key.57495#1 (Rabin)
                 Key Label: Alex
          wrote key: /tmp/member.key.57495
          give QlRHH7Zxl+PvqdezlR6kssss4wo and a member name to project administrator

          yipal% pastctl addmember -k QlRHH7Zxl+PvqdezlR6kssss4wo Alex testproject
          new member: Alex, QlRHH7Zxl+PvqdezlR6kssss4wo

Then, create some files and import them into the project:

          yipal% mkdir initial_files; cd initial_files
          yipal% echo 'int main(void) {printf("Hello Pastwatch\n");}' > main.c

          yipal% past -p testproject import -m "Initial import" testproject
          pastwatch: Creating a new log key and log for this replica.
          pastwatch: Member block currently has 0 entries:
          pastwatch: sfscd not running, limiting sources of entropy
          Creating new key: yipal@sweat.lcs.mit.edu
                 Key Label: yipal@sweat.lcs.mit.edu [press enter]
          pastwatch: no replica, building from scratch
          pastwatch: root of branch tree 9e7ZVaFGdhCuRsxVKmTpz0m1et0
          pastwatch: new snapshot: De0V6cD4FO6AP31cI+yW8jdnXrQ, 1 deltas.  For commit record: 9e7ZVaFGdhCuRsxVKmTpz0m1et0
          pastwatch: no new deltas, no new snapshots built
          pastwatch: Using branch head: 9e7ZVaFGdhCuRsxVKmTpz0m1et0
          N ./main.c
          pastwatch: committing
          pastwatch: new snapshot: nAdZr8wES4nrFXulnaylQAd-VYo, 5 deltas.  For commit record: 0WPRgjsWg0u4wG9zejuGaefua9o

Now you can checkout a working copy of the project files:

          yipal% cd /tmp
          yipal% past -p testproject checkout -d working_dir testproject
          pastwatch: no new deltas, no new snapshots built
          pastwatch: Using branch head: 0WPRgjsWg0u4wG9zejuGaefua9o
          D working_dir
          U working_dir/main.c

And edit the working copy:

          yipal% cd working_dir
          yipal% echo "// Written by Alex Yip" >> main.c

          yipal% past diff main.c
          pastwatch: Using branch: init
          pastwatch: no new deltas, no new snapshots built
          pastwatch: Using branch head: 0WPRgjsWg0u4wG9zejuGaefua9o
          File: main.c
          ===============================================
          diff -t yipal@sweat.lcs.mit.edu:2 main.c
          1a2
          > // Written by Alex Yip

Finally, you can commit your changes to the repository:

          yipal% past commit -m "Added by-line"
          pastwatch: Using branch: init
          pastwatch: no new deltas, no new snapshots built
          pastwatch: Using branch head: 0WPRgjsWg0u4wG9zejuGaefua9o
          pastwatch: checking for updates and conflicts
          pastwatch: updating .
          M main.c
          pastwatch: committing in .
          Committing main.c
          pastwatch: committing
          pastwatch: new snapshot: HXN45VZLzxK2qDvNBRaLgC7zgMg, 1 deltas.  For commit record: gD9vlfvoof90VT2ZXXZAfKt9fKM

That's the easiest way to get started using Pastwatch.  The next chapter provides more details about how to use Pastwatch.