remove stale files

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

eelliott

remove stale files

Post by eelliott » Tue Nov 15, 2005 2:07 pm

Here's a pretty common scenario:
  1. A file exists in the repository, and at some point, is fetched using get latest to a client machine.
  2. Someone deletes the file in the repository
  3. Later on, a get latest is done, but the file that was deleted in the repository still exists on the client machine.
  4. This causes a project to continue to build correctly, when it should report an error because the file shouldn't exist anymore.
Is there anyway to prevent this other than deleting the entire directory tree on the client, then performing another get latest? This is really not an option for me, since there are multiple built projects that would get destroyed.

eelliott

Post by eelliott » Tue Nov 15, 2005 2:09 pm

Forgot to include the version information:

Version 2.0.6 (2219)

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Post by lbauer » Tue Nov 15, 2005 2:18 pm

You should be able to configure this in the GUI Client under Tools->Options->Local Files->Perform Repository Deletions locally. "Remove Working Copy" should delete the file from you working directory on the next Get latest on the folder.

I think this works in the GUI Client, but not in Visual Studio.
Linda Bauer
SourceGear
Technical Support Manager

eelliott

Post by eelliott » Tue Nov 15, 2005 2:44 pm

Thanks, that seems to work from the GUI, but not from the command line.

Code: Select all

:: Pull the files from vault
echo Logging into vault...
vault rememberlogin -user %USER% -password %PASS% -host %HOST% -repository %REPOS%
echo Setting working folder in project %PROJ% to directory \%RESTOFPATH%...
vault setworkingfolder %PROJ% \%RESTOFPATH%
echo Getting files...
vault get -out \%RESTOFPATH%\vaultout.txt -verbose %PROJ%
vault unsetworkingfolder %PROJ%
echo Logging off...
vault forgetlogin
Is this because I unset the working folder from my batch file? Should I configure the GUI to store the working folder data inside the working folders? Something else?

eelliott

Post by eelliott » Wed Nov 16, 2005 1:55 pm

I'm still not able to get the vault command line client to delete stale files. Can anyone help me?

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Post by lbauer » Fri Nov 18, 2005 10:02 am

The Vault command line client does not remove files from the working folder if they have been deleted from the database. This functionality is only available in the GUI Client.
Linda Bauer
SourceGear
Technical Support Manager

eelliott

Post by eelliott » Fri Nov 18, 2005 10:32 am

Why are there so many differences between the GUI client and the command-line client? Shouldn't they be made to work the same?

eelliott

Post by eelliott » Fri Nov 18, 2005 10:35 am

Is there anyway I can automate a get that will remove the stale files? Or I am reduced to manually doing the get from a gui?

dan
Posts: 2448
Joined: Wed Dec 17, 2003 5:03 pm
Location: SourceGear
Contact:

Post by dan » Mon Nov 21, 2005 1:43 pm

Actually, I just checked the Command Line Client in the most recent version, and it does remove stale files by default on a GET operation, so it should serve your purposes. I'm not sure if it worked exactly the same in the 2.0 version of Vault though, but you could try it out.

eelliott
Posts: 6
Joined: Mon Jan 16, 2006 10:18 am

Post by eelliott » Mon Jan 16, 2006 10:22 am

We just upgraded to version 3.1.5.3546 and the CLC still does not remove the stale files when doing a 'GetLatest'. Is there something I need to do (complete re-get, etc.)?

I upgraded the client side software, and then immediately logged in and performed the get, but it still did not remove files that were deleted from the repository.[/quote]

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Post by lbauer » Tue Jan 17, 2006 8:30 am

Are you doing a get to a working folder or to a non-working folder, using -destpath?

Could you post your command (taking out any actual connection info)?
Linda Bauer
SourceGear
Technical Support Manager

eelliott
Posts: 6
Joined: Mon Jan 16, 2006 10:18 am

Post by eelliott » Tue Jan 17, 2006 3:13 pm

lbauer wrote:Are you doing a get to a working folder or to a non-working folder, using -destpath?

Could you post your command (taking out any actual connection info)?
Sure thing:

Code: Select all

vault rememberlogin -user %USER% -password %PASS% -host %HOST% -repository %REPOS% -out %TEMPDIR%\vaultout.txt
vault setworkingfolder %PROJ% %RESTOFPATH% -out %TEMPDIR%\vaultout.txt
vault get -makereadonly -performdeletions removeworkingcopyifunmodified -setfiletime modification -out %RESTOFPATH%\vaultout.txt -verbose %PROJ%
vault unsetworkingfolder %PROJ%
vault forgetlogin

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Post by lbauer » Wed Jan 18, 2006 10:12 am

This thread referes to "stale" files. Are you trying to delete files in the working directory that have been deleted in the database?

I ran just a "Get" command with the CLC and files that had been deleted from the database were deleted in the working folder.

There may be a problem with your command. For instance, setting and unsetting the working folder in the same command may prevent Vault from determining the state of the working folder.
Linda Bauer
SourceGear
Technical Support Manager

eelliott
Posts: 6
Joined: Mon Jan 16, 2006 10:18 am

Post by eelliott » Wed Jan 18, 2006 10:40 am

It's not really the same command, since I call the vault.exe 5 separate times in the batch file, but I'll try to remove the unsetworkingfolder command and see what happens.

[EDIT]
I tried that, and it still didn't remove the file from the working folder that was deleted in the repository.

Your comment about not determining the state of the working folder seems strange to me, since it has no problem determining what files it has to get (only gets updated files). So I don't understand the difference between determining new files versus old files?
[/EDIT]

dan
Posts: 2448
Joined: Wed Dec 17, 2003 5:03 pm
Location: SourceGear
Contact:

Post by dan » Wed Jan 18, 2006 4:12 pm

I believe that the "performrepositorydeletions" switch only works if the files had been previously retrieved to a working folder. Otherwise, Vault doesn't know whether they are modified or not - they are just files in the same folder that don't match any file in the current repository folder.

So, I think this would work:

1. Set the working folder
2. Do a Get Latest
3. Have someone else delete one of the files
4. Do another get latest. The deleted file in the repository should now be removed in the local folder.

It looks like you are setting the working folder, and then wanting the Get to delete a file because it doesn't exist in the Vault folder. However, Vault doesn't know that the file used to exist unless the working folder is set up before the file was deleted.

Hope this makes sense,

Post Reply