Checkout on save

3 views
Skip to first unread message

tim.burris

unread,
Mar 13, 2008, 6:59:49 PM3/13/08
to niftyplugins
I filed issues 13 & 15 a while back. I theorized that both these
issues could be solved by opening files for edit when they are saved
instead of when they are changed. I've been poking at it the last
couple days and now have a working autoCheckoutOnSave feature.

I'm going to distribute this new version internally. I'd love to send
the changes over to you for review and possible inclusion in the
public project.

Jim Tilander

unread,
Mar 13, 2008, 7:03:12 PM3/13/08
to niftyp...@googlegroups.com
Hi Tim,

I'd be more than happy to incorporate those changes. I'd most probably
put it on an option and make a new package.

Cheers,
Jim Tilander

--
Beware of architect astronauts.

tim.burris

unread,
Mar 13, 2008, 8:02:59 PM3/13/08
to niftyplugins
Permission to check in? Trying to branch to branches/timb. Or would
you prefer me to send the files some other way?

On Mar 13, 4:03 pm, "Jim Tilander" <j...@tilander.org> wrote:
> Hi Tim,
>
> I'd be more than happy to incorporate those changes. I'd most probably
> put it on an option and make a new package.
>
> Cheers,
> Jim Tilander
>

Jim Tilander

unread,
Mar 13, 2008, 8:19:36 PM3/13/08
to niftyp...@googlegroups.com
Just sending me the output from svn diff, or a zipfile of the project
would be fine.

/j

Jim Tilander

unread,
Mar 14, 2008, 12:28:31 AM3/14/08
to niftyp...@googlegroups.com
Ok, the new version is in. Note that I made the autocheckout on save
feature turned off by default since I can see it interfering with
normal scc plugins (yes, I'm running that somewhat crazy setup at
work). Please check out the new binary at

http://niftyplugins.googlecode.com/svn/trunk/Build/Experimental_NiftyPerforce.msi

and take it for a spin. Thanks for the patch!

/j

tim.burris

unread,
Mar 17, 2008, 5:56:59 PM3/17/08
to niftyplugins
Awesome! I'll check it out asap.

I'll have another patch in a while: I've discovered that Refactoring
operations use a different Save command, so that will need to be
handled as well. But I have a bunch of other unrelated stuff to work
on first.

On Mar 13, 9:28 pm, "Jim Tilander" <j...@tilander.org> wrote:
> Ok, the new version is in. Note that I made the autocheckout on save
> feature turned off by default since I can see it interfering with
> normal scc plugins (yes, I'm running that somewhat crazy setup at
> work). Please check out the new binary at
>
> http://niftyplugins.googlecode.com/svn/trunk/Build/Experimental_Nifty...
>
> and take it for a spin. Thanks for the patch!
>
> /j
>
>
>
> On Thu, Mar 13, 2008 at 5:19 PM, Jim Tilander <j...@tilander.org> wrote:
> > Just sending me the output from svn diff, or a zipfile of the project
> > would be fine.
>
> > /j
>

tim.burris

unread,
Mar 20, 2008, 10:54:18 PM3/20/08
to niftyplugins
I've found some other rough spots and I'm in the middle of smoothing
them out. I'll get the diff to you after running through the paces a
bit more.

Changes include:
Check out on Build commands. Apparently there is an explicit save of
projects & the solution, but an implicit save of project items.
Don't try to add a file with no name
Don't check out unmodified files during save selected
Commented-out event hook to track all commands and write their name,
guid, and id to the debug stream (I use this to determine which
commands to handle)

I have not covered the Refactor commands yet.

I looked into implementing the IVsQueryEditQuerySave2 interface so
that all cases of saving a file would be covered, but a) it requires
implementing as a VSPackage and b) the documentation indicates that
only a full source control package can implement this interface.
We're trying to avoid the performance degradation and shoehorned
kludginess of a full source control package. It ended up a more
complex project than I'm willing to take on.

tim.burris

unread,
Mar 24, 2008, 10:35:14 PM3/24/08
to niftyplugins
I added "&& !m_application.ActiveDocument.Saved) to the OnLineChanged
handler. This appears to address Issue 13 without enabling the
autoCheckoutOnSave handlers.

Could you go into a little more detail about the "I can't get this one
to fire reliably" comment? I've been playing around with enabling
OnLineChanged by itself by putting the OnBeforeKeyPress handler into
its own 'autoCheckoutOnKey' config value. I have found that VS waits
to fire LineChanged until you enter a new line, save, or switch focus
away from VS. So far this is ideal behavior for me - the file gets
checked out reliably before it's time to submit, but allows accidental
edit & undo without checking out. A common complaint about both p4scc
& niftyperforce around here arises when a dev loses track of which
window has focus and accidentally types into a document that doesn't
need to change.

I'm still massaging these changes, but I'm starting to suspect the
autoCheckoutOnSave functionality is a frayed rope, that going in that
direction will be trouble. So many commands save behind the scenes;
new ones will be introduced and old ones might go away as VS evolves.
(e.g. The reference I used to implement this functionality talked
about "File.Save", a command that does not exist in VS 2005.)

Jim Tilander

unread,
Mar 25, 2008, 12:35:14 AM3/25/08
to niftyp...@googlegroups.com
(Copying the code into the thread)

--- code ---
// [jt] This handler checks for things like paste operations. In
theory we should be able to remove the handler above, but
// I can't get this one to fire reliably... Wonder how much these
handlers will slow down the IDE?
void OnLineChanged(TextPoint StartPoint, TextPoint EndPoint, int Hint)
{
if ((Hint & (int)vsTextChanged.vsTextChangedNewline) == 0 &&
(Hint & (int)vsTextChanged.vsTextChangedMultiLine) == 0 &&
(Hint & (int)vsTextChanged.vsTextChangedNewline) == 0 &&
(Hint != 0))
return;
if (Singleton<Config>.Instance.autoCheckout &&
m_application.ActiveDocument.ReadOnly)
P4Operations.EditFile(m_outputPane, m_application.ActiveDocument.FullName);
}
--- code ---

Ok. So I think I remember that I had a breakpoint in the
function-entry and it didn't fire at all times I would expect it to. I
think that was the extent to which I worried about it since I only put
this code in here to begin with at a feature request (I'm not eating
my own dogfood here for this particular feature :).

If you've got it working reliably, that's great!

I'm unsure as to the behavior you want from the code change, but a
smaller (like your one-liner) is always better in my eyes :)


Cheers,
Jim

Reply all
Reply to author
Forward
0 new messages