microsoft / p4vfs

Microsoft Virtual File System for Perforce
MIT License
272 stars 13 forks source link

What is the best way to add this to P4V? #11

Open zedmilner opened 1 year ago

zedmilner commented 1 year ago

In P4V I can add it as a Custom tool, but if I select Run tool in terminal window, I can see the error logs, but no way to know when it's finished. If I also check Close window upon completion, then I kinda get a clue when it's finished (the window disappears), but then I can't read any errors.

If I don't select Run tool in terminal window, then the output is not visible anywhere, so that's not great either.

Also when using this as a P4V Custom Tool, I couldn't find a way to select just some folders and run p4vfs sync on those. It only shows up in the context menu when I select the workspace root folder. If I add %f or %F to the command line args ( those the only two that are using workspace syntax), then it doesn't show up in the context menu of any folders.

I'd be interested to learn how others integrated this to their workflow.

jessk-msft commented 1 year ago

Hi @zedmilner, in most cases that I know of we typically use p4vfs.exe commands a few ways:

Using a p4vfs command from a Custom Tool context menu is certainly an option. After a little experimentation, I'd probably suggest something like this in the %USERPROFILE%\.p4qt\customtools.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!--perforce-xml-version=1.0-->
<CustomToolDefList varName="customtooldeflist">
 <CustomToolDef>
  <Definition>
   <Name>Virtual Sync</Name>
   <Command>p4vfs.exe</Command>
   <Arguments>sync %D</Arguments>
   <Shortcut></Shortcut>
  </Definition>
  <Console>
   <CloseOnExit>false</CloseOnExit>
  </Console>
  <AddToContext>true</AddToContext>
  <Refresh>true</Refresh>
 </CustomToolDef>
</CustomToolDefList>

You'll know the sync is complete when the sync summary shows at the bottom. You could also wrap this in a script if you wanted more detail. At Microsoft we have a tool that we can run from P4V shows a status bar of the progress of a p4vfs sync. Where progress is determined by reading the first count "(\d+) Modification messages to act on." followed by counting the number of lines output. I'll ask if one of my colleagues would be interested in contributing the source of that tool if anyone is interested. Regards -Jess