Link existing session-dir to new work-dir

For example, let's say you accidentally delete your work dir, and you want it back. Or you are moving to a new repository, which has replicas of your immutable directories under /vesta/ but will have a different /vesta-work/. If you had an exclusive checkout session, and you want to simply check-in, you can just follow the FAQ entry "I removed my working directory instead of checking in. How can I fix it?"

But if you want to keep editing, especially if it's a non-exclusive checkout, you can re-create your work-dir and do a little fix-up, then keep editing, vadvance. For an exclusive checkout, you can even vcheckin when you're ready.

First you have to find your session-dir. See the aforementioned FAQ entry "I removed my working directory instead of checking in. How can I fix it?" for help.

Non-Exclusive checkout

First consider the case that your work-dir was for a non-exclusive checkout.

Let's say your session dir is /vesta/example.com/foo/checkout/5.user_example.com.1/7, meaning that v7 was the most recent snapshot of your previous work-dir.

Recreate the work-dir

vcheckout -N -S -w /vesta-work/$USER/foo -o checkout/5.user_example.com.1/7 /vesta/example.com/foo

-N says dont create a new version (we already have one :)

-S says dont create a session-dir (we already have one :)

-w says where to put the work-dir

-o says to initialize the work-dir with a specific checkout version

Add the session-dir attribute

vattrib -a session-dir /vesta/example.com/foo/checkout/5.user_example.com.1 /vesta-work/$USER/foo

-a attrib value means add the value to attrib (creating attrib if previously empty)

Add the session-ver-arc attribute

vattrib -a session-ver-arc 7 /vesta-work/$USER/foo

the session-ver-arc notes the highest numbered version of the snapshots of the work-dir.

Moving Between Repositories

Note that while you can use this method to restart a non-exclusive checkout on a different repository, in order to take new snapshots in an existing session directory the repository where you're running vadvance must have mastership of the session directory. You can check this with vattrib:

% vattrib -m /vesta/example.com/foo/checkout/5.user_example.com.1
master

If vattrib tells you that your repository has a non-master replica:

% vattrib -m /vesta/example.com/foo/checkout/5.user_example.com.1
nonmaster

Then you will need to acquire mastership of it with vmaster:

% vmaster /vesta/example.com/foo/checkout/5.user_example.com.1

Exclusive checkout

Now let's consider that your work-dir was for an Exclusive checkout. In this case your session-dir will look different, and there's one additional new-version step at the end.

Let's say your session dir is /vesta/example.com/foo/checkout/5/7, meaning that v7 was the most recent snapshot of your previous work-dir.

Recreate the work-dir

vcheckout -N -S -w /vesta-work/$USER/foo -o checkout/5/7 /vesta/example.com/foo

(the non-exclusive exampe above describes the options)

Add the session-dir attribute

vattrib -a session-dir /vesta/example.com/foo/checkout/5 /vesta-work/$USER/foo

(the non-exclusive exampe above describes the arguments)

Add the session-ver-arc attribute

vattrib -a session-ver-arc 7 /vesta-work/$USER/foo

(the non-exclusive exampe above describes the arguments)

Add the new-version attribute

If this is an exclusive checkout, then there will be a new version reservation that we should place on the work-dir

vattrib -a new-version /vesta/example.com/foo/5 /vesta-work/$USER/foo