[niftyplugins] r86 committed - - Experimental support for doing edits on writable files (for when you...

2 views
Skip to first unread message

codesite...@google.com

unread,
Jun 2, 2010, 2:21:13 AM6/2/10
to niftyplug...@googlegroups.com
Revision: 86
Author: jim.tilander
Date: Tue Jun 1 23:20:33 2010
Log: - Experimental support for doing edits on writable files (for when you
have a writable workspace). This can be useful if you have a git repository
(or Hg?) above your perforce workspace.

http://code.google.com/p/niftyplugins/source/detail?r=86

Added:
/trunk/bin
/trunk/bin/googlecode_upload.py
Modified:
/trunk/Build/Experimental_NiftyPerforce.msi
/trunk/Build/Experimental_NiftySolution.msi
/trunk/NiftyPerforce/Commands/P4EditItem.cs
/trunk/NiftyPerforce/Commands/P4EditModified.cs
/trunk/NiftyPerforce/Commands/P4EditSolution.cs
/trunk/NiftyPerforce/Commands/P4RenameItem.cs
/trunk/NiftyPerforce/Config.cs
/trunk/NiftyPerforce/EventHandlers/AutoAddDelete.cs
/trunk/NiftyPerforce/EventHandlers/AutoCheckoutOnBuild.cs
/trunk/NiftyPerforce/EventHandlers/AutoCheckoutOnSave.cs
/trunk/NiftyPerforce/EventHandlers/AutoCheckoutProject.cs
/trunk/NiftyPerforce/EventHandlers/AutoCheckoutTextEdit.cs
/trunk/NiftyPerforce/P4Operations.cs

=======================================
--- /dev/null
+++ /trunk/bin/googlecode_upload.py Tue Jun 1 23:20:33 2010
@@ -0,0 +1,248 @@
+#!/usr/bin/env python
+#
+# Copyright 2006, 2007 Google Inc. All Rights Reserved.
+# Author: dand...@google.com (David Anderson)
+#
+# Script for uploading files to a Google Code project.
+#
+# This is intended to be both a useful script for people who want to
+# streamline project uploads and a reference implementation for
+# uploading files to Google Code projects.
+#
+# To upload a file to Google Code, you need to provide a path to the
+# file on your local machine, a small summary of what the file is, a
+# project name, and a valid account that is a member or owner of that
+# project. You can optionally provide a list of labels that apply to
+# the file. The file will be uploaded under the same name that it has
+# in your local filesystem (that is, the "basename" or last path
+# component). Run the script with '--help' to get the exact syntax
+# and available options.
+#
+# Note that the upload script requests that you enter your
+# googlecode.com password. This is NOT your Gmail account password!
+# This is the password you use on googlecode.com for committing to
+# Subversion and uploading files. You can find your password by going
+# to http://code.google.com/hosting/settings when logged in with your
+# Gmail account. If you have already committed to your project's
+# Subversion repository, the script will automatically retrieve your
+# credentials from there (unless disabled, see the output of '--help'
+# for details).
+#
+# If you are looking at this script as a reference for implementing
+# your own Google Code file uploader, then you should take a look at
+# the upload() function, which is the meat of the uploader. You
+# basically need to build a multipart/form-data POST request with the
+# right fields and send it to https://PROJECT.googlecode.com/files .
+# Authenticate the request using HTTP Basic authentication, as is
+# shown below.
+#
+# Licensed under the terms of the Apache Software License 2.0:
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Questions, comments, feature requests and patches are most welcome.
+# Please direct all of these to the Google Code users group:
+# http://groups.google.com/group/google-code-hosting
+
+"""Google Code file uploader script.
+"""
+
+__author__ = 'dand...@google.com (David Anderson)'
+
+import httplib
+import os.path
+import optparse
+import getpass
+import base64
+import sys
+
+
+def upload(file, project_name, user_name, password, summary, labels=None):
+ """Upload a file to a Google Code project's file server.
+
+ Args:
+ file: The local path to the file.
+ project_name: The name of your project on Google Code.
+ user_name: Your Google account name.
+ password: The googlecode.com password for your account.
+ Note that this is NOT your global Google Account password!
+ summary: A small description for the file.
+ labels: an optional list of label strings with which to tag the file.
+
+ Returns: a tuple:
+ http_status: 201 if the upload succeeded, something else if an
+ error occured.
+ http_reason: The human-readable string associated with http_status
+ file_url: If the upload succeeded, the URL of the file on Google
+ Code, None otherwise.
+ """
+ # The login is the user part of us...@gmail.com. If the login provided
+ # is in the full user@domain form, strip it down.
+ if user_name.endswith('@gmail.com'):
+ user_name = user_name[:user_name.index('@gmail.com')]
+
+ form_fields = [('summary', summary)]
+ if labels is not None:
+ form_fields.extend([('label', l.strip()) for l in labels])
+
+ content_type, body = encode_upload_request(form_fields, file)
+
+ upload_host = '%s.googlecode.com' % project_name
+ upload_uri = '/files'
+ auth_token = base64.b64encode('%s:%s'% (user_name, password))
+ headers = {
+ 'Authorization': 'Basic %s' % auth_token,
+ 'User-Agent': 'Googlecode.com uploader v0.9.4',
+ 'Content-Type': content_type,
+ }
+
+ server = httplib.HTTPSConnection(upload_host)
+ server.request('POST', upload_uri, body, headers)
+ resp = server.getresponse()
+ server.close()
+
+ if resp.status == 201:
+ location = resp.getheader('Location', None)
+ else:
+ location = None
+ return resp.status, resp.reason, location
+
+
+def encode_upload_request(fields, file_path):
+ """Encode the given fields and file into a multipart form body.
+
+ fields is a sequence of (name, value) pairs. file is the path of
+ the file to upload. The file will be uploaded to Google Code with
+ the same file name.
+
+ Returns: (content_type, body) ready for httplib.HTTP instance
+ """
+ BOUNDARY = '----------Googlecode_boundary_reindeer_flotilla'
+ CRLF = '\r\n'
+
+ body = []
+
+ # Add the metadata about the upload first
+ for key, value in fields:
+ body.extend(
+ ['--' + BOUNDARY,
+ 'Content-Disposition: form-data; name="%s"' % key,
+ '',
+ value,
+ ])
+
+ # Now add the file itself
+ file_name = os.path.basename(file_path)
+ f = open(file_path, 'rb')
+ file_content = f.read()
+ f.close()
+
+ body.extend(
+ ['--' + BOUNDARY,
+ 'Content-Disposition: form-data; name="filename"; filename="%s"'
+ % file_name,
+ # The upload server determines the mime-type, no need to set it.
+ 'Content-Type: application/octet-stream',
+ '',
+ file_content,
+ ])
+
+ # Finalize the form body
+ body.extend(['--' + BOUNDARY + '--', ''])
+
+ return 'multipart/form-data; boundary=%s' % BOUNDARY, CRLF.join(body)
+
+
+def upload_find_auth(file_path, project_name, summary, labels=None,
+ user_name=None, password=None, tries=3):
+ """Find credentials and upload a file to a Google Code project's file
server.
+
+ file_path, project_name, summary, and labels are passed as-is to upload.
+
+ Args:
+ file_path: The local path to the file.
+ project_name: The name of your project on Google Code.
+ summary: A small description for the file.
+ labels: an optional list of label strings with which to tag the file.
+ config_dir: Path to Subversion configuration directory, 'none', or
None.
+ user_name: Your Google account name.
+ tries: How many attempts to make.
+ """
+
+ while tries > 0:
+ if user_name is None:
+ # Read username if not specified or loaded from svn config, or on
+ # subsequent tries.
+ sys.stdout.write('Please enter your googlecode.com username: ')
+ sys.stdout.flush()
+ user_name = sys.stdin.readline().rstrip()
+ if password is None:
+ # Read password if not loaded from svn config, or on subsequent
tries.
+ print 'Please enter your googlecode.com password.'
+ print '** Note that this is NOT your Gmail account password! **'
+ print 'It is the password you use to access Subversion repositories,'
+ print 'and can be found here:
http://code.google.com/hosting/settings'
+ password = getpass.getpass()
+
+ status, reason, url = upload(file_path, project_name, user_name,
password,
+ summary, labels)
+ # Returns 403 Forbidden instead of 401 Unauthorized for bad
+ # credentials as of 2007-07-17.
+ if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]:
+ # Rest for another try.
+ user_name = password = None
+ tries = tries - 1
+ else:
+ # We're done.
+ break
+
+ return status, reason, url
+
+
+def main():
+ parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY '
+ '-p PROJECT [options] FILE')
+ parser.add_option('-s', '--summary', dest='summary',
+ help='Short description of the file')
+ parser.add_option('-p', '--project', dest='project',
+ help='Google Code project name')
+ parser.add_option('-u', '--user', dest='user',
+ help='Your Google Code username')
+ parser.add_option('-w', '--password', dest='password',
+ help='Your Google Code password')
+ parser.add_option('-l', '--labels', dest='labels',
+ help='An optional list of comma-separated labels to
attach '
+ 'to the file')
+
+ options, args = parser.parse_args()
+
+ if not options.summary:
+ parser.error('File summary is missing.')
+ elif not options.project:
+ parser.error('Project name is missing.')
+ elif len(args) < 1:
+ parser.error('File to upload not provided.')
+ elif len(args) > 1:
+ parser.error('Only one file may be specified.')
+
+ file_path = args[0]
+
+ if options.labels:
+ labels = options.labels.split(',')
+ else:
+ labels = None
+
+ status, reason, url = upload_find_auth(file_path, options.project,
+ options.summary, labels,
+ options.user, options.password)
+ if url:
+ print 'The file was uploaded successfully.'
+ print 'URL: %s' % url
+ return 0
+ else:
+ print 'An error occurred. Your file was not uploaded.'
+ print 'Google Code upload server said: %s (%s)' % (reason, status)
+ return 1
+
+
+if __name__ == '__main__':
+ sys.exit(main())
=======================================
--- /trunk/Build/Experimental_NiftyPerforce.msi Tue Jun 1 22:46:36 2010
+++ /trunk/Build/Experimental_NiftyPerforce.msi Tue Jun 1 23:20:33 2010
Binary file, no diff available.
=======================================
--- /trunk/Build/Experimental_NiftySolution.msi Tue Jun 1 22:46:36 2010
+++ /trunk/Build/Experimental_NiftySolution.msi Tue Jun 1 23:20:33 2010
Binary file, no diff available.
=======================================
--- /trunk/NiftyPerforce/Commands/P4EditItem.cs Fri Apr 24 00:40:16 2009
+++ /trunk/NiftyPerforce/Commands/P4EditItem.cs Tue Jun 1 23:20:33 2010
@@ -36,7 +36,8 @@

public override void OnExecute(SelectedItem item, string
fileName, OutputWindowPane pane)
{
- P4Operations.EditFile(pane, fileName);
+ bool ignoreReadOnly = ((Config)Plugin.Options).ignoreReadOnlyOnEdit;
+ P4Operations.EditFile(pane, fileName, ignoreReadOnly);
}
}
}
=======================================
--- /trunk/NiftyPerforce/Commands/P4EditModified.cs Thu Apr 30 01:04:22 2009
+++ /trunk/NiftyPerforce/Commands/P4EditModified.cs Tue Jun 1 23:20:33 2010
@@ -17,10 +17,16 @@
public override bool OnCommand()
{
Log.Info("Got build solution command, now checking {0} documents for
modification", Plugin.App.Documents.Count);
+
+ bool ignoreReadOnly = ((Config)(Plugin.Options)).ignoreReadOnlyOnEdit;
+
foreach (Document doc in Plugin.App.Documents)
{
- if (!doc.Saved && doc.ReadOnly)
- P4Operations.EditFile(Plugin.OutputPane, doc.FullName);
+ if(doc.Saved)
+ continue;
+ if(!ignoreReadOnly && !doc.ReadOnly)
+ continue;
+ P4Operations.EditFile(Plugin.OutputPane, doc.FullName,
ignoreReadOnly);
}

return true;
=======================================
--- /trunk/NiftyPerforce/Commands/P4EditSolution.cs Fri Apr 24 00:40:16 2009
+++ /trunk/NiftyPerforce/Commands/P4EditSolution.cs Tue Jun 1 23:20:33 2010
@@ -30,7 +30,8 @@
{
if(Plugin.App.Solution != null && Plugin.App.Solution.FullName !=
string.Empty)
{
- P4Operations.EditFile(Plugin.OutputPane,
Plugin.App.Solution.FullName);
+ Config cfg = Plugin.Options as Config;
+ P4Operations.EditFile(Plugin.OutputPane,
Plugin.App.Solution.FullName, cfg.ignoreReadOnlyOnEdit);
return true;
}
return false;
=======================================
--- /trunk/NiftyPerforce/Commands/P4RenameItem.cs Fri Apr 24 00:40:16 2009
+++ /trunk/NiftyPerforce/Commands/P4RenameItem.cs Tue Jun 1 23:20:33 2010
@@ -31,7 +31,7 @@
{
string newName = dlg.FileName;
P4Operations.IntegrateFile(pane, newName, fileName);
- P4Operations.EditFile(pane,
item.ProjectItem.ContainingProject.FullName);
+ P4Operations.EditFile(pane,
item.ProjectItem.ContainingProject.FullName,
((Config)Plugin.Options).ignoreReadOnlyOnEdit);
item.ProjectItem.Collection.AddFromFile(newName);
item.ProjectItem.Delete();
P4Operations.DeleteFile(pane, fileName);
=======================================
--- /trunk/NiftyPerforce/Config.cs Thu Apr 30 01:04:22 2009
+++ /trunk/NiftyPerforce/Config.cs Tue Jun 1 23:20:33 2010
@@ -21,6 +21,7 @@
private bool m_autoAdd = true;
private bool m_autoDelete = false;
private bool m_useSystemConnection = true;
+ private bool m_ignoreReadOnlyOnEdit = false;
//private bool m_warnOnEditNewerFile = false;
private string m_port = "";
private string m_client = "";
@@ -95,6 +96,13 @@
get { return m_autoDelete; }
set { m_autoDelete = value; mDirty = true; }
}
+
+ [Category("Operation"), Description("Try to do a p4 edit even though
the file is writable. Useful if you have a git repository above your p4
workspace. Costly!")]
+ public bool ignoreReadOnlyOnEdit
+ {
+ get { return m_ignoreReadOnlyOnEdit; }
+ set { m_ignoreReadOnlyOnEdit = value; mDirty = true; }
+ }

/*[Category("Operation"), Description("Throw up a dialog box if you try
to edit a file that has a newer version in the repository.")]
public bool warnOnEditNewerFile
=======================================
--- /trunk/NiftyPerforce/EventHandlers/AutoAddDelete.cs Thu Apr 30 01:25:16
2009
+++ /trunk/NiftyPerforce/EventHandlers/AutoAddDelete.cs Tue Jun 1 23:20:33
2010
@@ -40,7 +40,7 @@

public void OnItemAdded(ProjectItem item)
{
- P4Operations.EditFile(m_plugin.OutputPane,
item.ContainingProject.FullName);
+ P4Operations.EditFile(m_plugin.OutputPane,
item.ContainingProject.FullName,
((Config)m_plugin.Options).ignoreReadOnlyOnEdit);

for (int i = 0; i < item.FileCount; i++)
{
@@ -51,7 +51,7 @@

public void OnItemRemoved(ProjectItem item)
{
- P4Operations.EditFile(m_plugin.OutputPane,
item.ContainingProject.FullName);
+ P4Operations.EditFile(m_plugin.OutputPane,
item.ContainingProject.FullName,
((Config)m_plugin.Options).ignoreReadOnlyOnEdit);

for (int i = 0; i < item.FileCount; i++)
{
@@ -62,7 +62,7 @@

private void OnProjectAdded(Project project)
{
- P4Operations.EditFile(m_plugin.OutputPane,
m_plugin.App.Solution.FullName);
+ P4Operations.EditFile(m_plugin.OutputPane,
m_plugin.App.Solution.FullName,
((Config)m_plugin.Options).ignoreReadOnlyOnEdit);
P4Operations.AddFile(m_plugin.OutputPane, project.FullName);
// TODO: [jt] We should if the operation is not a add new project but
rather a add existing project
// step through all the project items and add them to perforce.
Or maybe we want the user
@@ -71,7 +71,7 @@

private void OnProjectRemoved(Project project)
{
- P4Operations.EditFile(m_plugin.OutputPane,
m_plugin.App.Solution.FullName);
+ P4Operations.EditFile(m_plugin.OutputPane,
m_plugin.App.Solution.FullName,
((Config)m_plugin.Options).ignoreReadOnlyOnEdit);
P4Operations.DeleteFile(m_plugin.OutputPane, project.FullName);
// TODO: [jt] Do we want to automatically delete the items from
perforce here?
}
=======================================
--- /trunk/NiftyPerforce/EventHandlers/AutoCheckoutOnBuild.cs Thu Apr 30
01:25:16 2009
+++ /trunk/NiftyPerforce/EventHandlers/AutoCheckoutOnBuild.cs Tue Jun 1
23:20:33 2010
@@ -27,10 +27,16 @@

private void OnCheckoutModifiedSource(string Guid, int ID, object
CustomIn, object CustomOut, ref bool CancelDefault)
{
+ Config cfg = mPlugin.Options as Config;
+ bool ignoreReadOnly = cfg.ignoreReadOnlyOnEdit;
+
foreach(Document doc in mPlugin.App.Documents)
{
- if(!doc.Saved && doc.ReadOnly)
- P4Operations.EditFileImmediate(mPlugin.OutputPane, doc.FullName);
+ if(doc.Saved)
+ continue;
+ if(!ignoreReadOnly && !doc.ReadOnly)
+ continue;
+ P4Operations.EditFileImmediate(mPlugin.OutputPane, doc.FullName,
ignoreReadOnly);
}
}
}
=======================================
--- /trunk/NiftyPerforce/EventHandlers/AutoCheckoutOnSave.cs Thu Apr 30
01:25:16 2009
+++ /trunk/NiftyPerforce/EventHandlers/AutoCheckoutOnSave.cs Tue Jun 1
23:20:33 2010
@@ -25,27 +25,31 @@

private void OnSaveSelected(string Guid, int ID, object CustomIn,
object CustomOut, ref bool CancelDefault)
{
+ Config cfg = mPlugin.Options as Config;
+
foreach(SelectedItem sel in mPlugin.App.SelectedItems)
{
if(sel.Project != null)
- P4Operations.EditFileImmediate(mPlugin.OutputPane,
sel.Project.FullName);
+ P4Operations.EditFileImmediate(mPlugin.OutputPane,
sel.Project.FullName, cfg.ignoreReadOnlyOnEdit);
else if(sel.ProjectItem != null)
- P4Operations.EditFileImmediate(mPlugin.OutputPane,
sel.ProjectItem.Document.FullName);
+ P4Operations.EditFileImmediate(mPlugin.OutputPane,
sel.ProjectItem.Document.FullName, cfg.ignoreReadOnlyOnEdit);
else
- P4Operations.EditFileImmediate(mPlugin.OutputPane,
mPlugin.App.Solution.FullName);
+ P4Operations.EditFileImmediate(mPlugin.OutputPane,
mPlugin.App.Solution.FullName, cfg.ignoreReadOnlyOnEdit);
}
}

private void OnSaveAll(string Guid, int ID, object CustomIn, object
CustomOut, ref bool CancelDefault)
{
+ Config cfg = mPlugin.Options as Config;
+
if(!mPlugin.App.Solution.Saved)
- P4Operations.EditFileImmediate(mPlugin.OutputPane,
mPlugin.App.Solution.FullName);
+ P4Operations.EditFileImmediate(mPlugin.OutputPane,
mPlugin.App.Solution.FullName, cfg.ignoreReadOnlyOnEdit);

foreach(Document doc in mPlugin.App.Documents)
{
if(doc.Saved)
continue;
- P4Operations.EditFileImmediate(mPlugin.OutputPane, doc.FullName);
+ P4Operations.EditFileImmediate(mPlugin.OutputPane, doc.FullName,
cfg.ignoreReadOnlyOnEdit);
}

if(mPlugin.App.Solution.Projects == null)
@@ -59,8 +63,10 @@

private void EditProjectRecursive(Project p)
{
+ Config cfg = mPlugin.Options as Config;
+
if(!p.Saved)
- P4Operations.EditFileImmediate(mPlugin.OutputPane, p.FullName);
+ P4Operations.EditFileImmediate(mPlugin.OutputPane, p.FullName,
cfg.ignoreReadOnlyOnEdit);

if(p.ProjectItems == null)
return;
@@ -74,7 +80,7 @@
else if(!pi.Saved)
{
for(short i = 1; i <= pi.FileCount; i++)
- P4Operations.EditFileImmediate(mPlugin.OutputPane,
pi.get_FileNames(i));
+ P4Operations.EditFileImmediate(mPlugin.OutputPane,
pi.get_FileNames(i), cfg.ignoreReadOnlyOnEdit);
}
}
}
=======================================
--- /trunk/NiftyPerforce/EventHandlers/AutoCheckoutProject.cs Thu Apr 30
01:25:16 2009
+++ /trunk/NiftyPerforce/EventHandlers/AutoCheckoutProject.cs Tue Jun 1
23:20:33 2010
@@ -28,9 +28,11 @@

private void OnCheckoutSelectedProjects(string Guid, int ID, object
CustomIn, object CustomOut, ref bool CancelDefault)
{
+ bool ignoreReadOnly = ((Config)mPlugin.Options).ignoreReadOnlyOnEdit;
+
foreach(Project project in (Array)mPlugin.App.ActiveSolutionProjects)
{
- P4Operations.EditFileImmediate(mPlugin.OutputPane, project.FullName);
+ P4Operations.EditFileImmediate(mPlugin.OutputPane, project.FullName,
ignoreReadOnly);
}
}
}
=======================================
--- /trunk/NiftyPerforce/EventHandlers/AutoCheckoutTextEdit.cs Thu Apr 30
01:25:16 2009
+++ /trunk/NiftyPerforce/EventHandlers/AutoCheckoutTextEdit.cs Tue Jun 1
23:20:33 2010
@@ -36,7 +36,7 @@
private void OnBeforeKeyPress(string Keypress, EnvDTE.TextSelection
Selection, bool InStatementCompletion, ref bool CancelKeypress)
{
if(mPlugin.App.ActiveDocument.ReadOnly)
- P4Operations.EditFile(mPlugin.OutputPane,
mPlugin.App.ActiveDocument.FullName);
+ P4Operations.EditFile(mPlugin.OutputPane,
mPlugin.App.ActiveDocument.FullName, false); // no auto p4 edit on
writeable files here since it will be too costly.
}

// [jt] This handler checks for things like paste operations. In theory
we should be able to remove the handler above, but
@@ -49,13 +49,13 @@
(Hint != 0))
return;
if(mPlugin.App.ActiveDocument.ReadOnly
&& !mPlugin.App.ActiveDocument.Saved)
- P4Operations.EditFile(mPlugin.OutputPane,
mPlugin.App.ActiveDocument.FullName);
+ P4Operations.EditFile(mPlugin.OutputPane,
mPlugin.App.ActiveDocument.FullName, false); // no auto p4 edit on
writeable files here since it will be too costly.
}

private void OnCheckoutCurrentDocument(string Guid, int ID, object
CustomIn, object CustomOut, ref bool CancelDefault)
{
if(mPlugin.App.ActiveDocument.ReadOnly
&& !mPlugin.App.ActiveDocument.Saved)
- P4Operations.EditFile(mPlugin.OutputPane,
mPlugin.App.ActiveDocument.FullName);
+ P4Operations.EditFile(mPlugin.OutputPane,
mPlugin.App.ActiveDocument.FullName, false); // no auto p4 edit on
writeable files here since it will be too costly.
}

}
=======================================
--- /trunk/NiftyPerforce/P4Operations.cs Tue Jun 1 22:46:36 2010
+++ /trunk/NiftyPerforce/P4Operations.cs Tue Jun 1 23:20:33 2010
@@ -45,22 +45,22 @@
return ScheduleRunCommand(output, "p4.exe", GetUserInfoString() + "add
\"" + filename + "\"", System.IO.Path.GetDirectoryName(filename));
}

- public static bool EditFile(OutputWindowPane output, string filename)
+ public static bool EditFile(OutputWindowPane output, string filename,
bool ignoreReadOnly)
{
if(filename.Length == 0)
return false;
- if(0 == (System.IO.File.GetAttributes(filename) &
FileAttributes.ReadOnly))
+ if(!ignoreReadOnly && 0 == (System.IO.File.GetAttributes(filename) &
FileAttributes.ReadOnly))
return false;
if(!g_p4installed)
return NotifyUser("could not find p4 exe installed in perforce
directory");
return ScheduleRunCommand(output, "p4.exe", GetUserInfoString()
+ "edit \"" + filename + "\"", System.IO.Path.GetDirectoryName(filename));
}

- public static bool EditFileImmediate(OutputWindowPane output, string
filename)
+ public static bool EditFileImmediate(OutputWindowPane output, string
filename, bool ignoreReadOnly)
{
if(filename.Length == 0)
return false;
- if(0 == (System.IO.File.GetAttributes(filename) &
FileAttributes.ReadOnly))
+ if(!ignoreReadOnly && 0 == (System.IO.File.GetAttributes(filename) &
FileAttributes.ReadOnly))
return false;
if(!g_p4installed)
return NotifyUser("could not find p4 exe installed in perforce
directory");

Reply all
Reply to author
Forward
0 new messages