/******************************************************************************* Copyright (c) 2011, Perforce Software, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE SOFTWARE, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ /******************************************************************************* * Name : Client.cs * * Author : dbb * * Description : Class used to abstract a client in Perforce. * ******************************************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Perforce.P4 { /// /// Flags to configure the client behavior. /// [Flags] public enum ClientOption { /// /// No options. /// None = 0x0000, /// /// Leaves all files writable on the client; /// by default, only files opened by 'p4 edit' /// are writable. If set, files might be clobbered /// as a result of ignoring the clobber option. /// AllWrite = 0x0001, /// /// Permits 'p4 sync' to overwrite writable /// files on the client. noclobber is ignored if /// allwrite is set. /// Clobber = 0x0002, /// /// Compresses data sent between the client /// and server to speed up slow connections. /// Compress = 0x0004, /// /// Allows only the client owner to use or change /// the client spec. Prevents the client spec from /// being deleted. /// Locked = 0x0008, /// /// Causes 'p4 sync' and 'p4 submit' to preserve /// file modification time, as with files with the /// +m type modifier. (See 'p4 help filetypes'.) /// With nomodtime, file timestamps are updated by /// sync and submit operations. /// ModTime = 0x0010, /// /// Makes 'p4 sync' attempt to delete a workspace /// directory when all files in it are removed. /// RmDir = 0x0020 }; internal class ClientOptionEnum : StringEnum { public ClientOptionEnum(ClientOption v) : base(v) { } public ClientOptionEnum(string spec) : base(ClientOption.None) { Parse(spec); } public static implicit operator ClientOptionEnum(ClientOption v) { return new ClientOptionEnum(v); } public static implicit operator ClientOptionEnum(string s) { return new ClientOptionEnum(s); } public static implicit operator string(ClientOptionEnum v) { return v.ToString(); } public override bool Equals(object obj) { if (obj.GetType() == typeof(ClientOption)) { return value.Equals((ClientOption)obj); } if (obj.GetType() == typeof(ClientOptionEnum)) { return value.Equals(((ClientOptionEnum)obj).value); } return false; } public static bool operator ==(ClientOptionEnum t1, ClientOptionEnum t2) { return t1.value.Equals(t2.value); } public static bool operator !=(ClientOptionEnum t1, ClientOptionEnum t2) { return !t1.value.Equals(t2.value); } public static bool operator ==(ClientOption t1, ClientOptionEnum t2) { return t1.Equals(t2.value); } public static bool operator !=(ClientOption t1, ClientOptionEnum t2) { return !t1.Equals(t2.value); } public static bool operator ==(ClientOptionEnum t1, ClientOption t2) { return t1.value.Equals(t2); } public static bool operator !=(ClientOptionEnum t1, ClientOption t2) { return !t1.value.Equals(t2); } /// /// Convert to a client spec formatted string /// /// public override string ToString() { return String.Format("{0} {1} {2} {3} {4} {5}", ((value & ClientOption.AllWrite) != 0) ? "allwrite" : "noallwrite", ((value & ClientOption.Clobber) != 0) ? "clobber" : "noclobber", ((value & ClientOption.Compress) != 0) ? "compress" : "nocompress", ((value & ClientOption.Locked) != 0) ? "locked" : "unlocked", ((value & ClientOption.ModTime) != 0) ? "modtime" : "nomodtime", ((value & ClientOption.RmDir) != 0) ? "rmdir" : "normdir" ); } /// /// Parse a client spec formatted string /// /// public void Parse(String spec) { value = ClientOption.None; if (!spec.Contains("noallwrite")) value |= ClientOption.AllWrite; if (!spec.Contains("noclobber")) value |= ClientOption.Clobber; if (!spec.Contains("nocompress")) value |= ClientOption.Compress; if (!spec.Contains("unlocked")) value |= ClientOption.Locked; if (!spec.Contains("nomodtime")) value |= ClientOption.ModTime; if (!spec.Contains("normdir")) value |= ClientOption.RmDir; } } /// /// Flags to change submit behavior. /// [Flags] public enum SubmitType { /// /// All open files are submitted (default). /// SubmitUnchanged = 0x000, /// /// Files that have content or type changes /// are submitted. Unchanged files are /// reverted. /// RevertUnchanged = 0x001, /// /// Files that have content or type changes /// are submitted. Unchanged files are moved /// to the default changelist. /// LeaveUnchanged = 0x002 } /// /// Client options that define what to do with files upon submit. /// public class ClientSubmitOptions { /// /// Determines if the files is reopened upon submit. /// public bool Reopen { get; set; } public ClientSubmitOptions() { } public ClientSubmitOptions(string spec) { Parse(spec); } public ClientSubmitOptions(bool reopen, SubmitType submitType) { Reopen = reopen; _submitType = submitType; } public static implicit operator ClientSubmitOptions(string s) { return new ClientSubmitOptions(s); } public static implicit operator string(ClientSubmitOptions v) { return v.ToString(); } public override bool Equals(object obj) { if (obj is ClientSubmitOptions) { ClientSubmitOptions o = obj as ClientSubmitOptions; return ((this._submitType == o._submitType) && (this.Reopen == o.Reopen)); } return false; } private StringEnum _submitType; public SubmitType SubmitType { get { return _submitType; } set { _submitType = value; } } /// /// Convert to a client spec formatted string /// /// public override string ToString() { String value = _submitType.ToString(StringEnumCase.Lower); if (Reopen) value += "+reopen"; return value; } /// /// Parse a client spec formatted string /// /// public void Parse(String spec) { _submitType = SubmitType.SubmitUnchanged; Reopen = false; if (spec.Contains("revertunchanged")) _submitType = SubmitType.RevertUnchanged; if (spec.Contains("leaveunchanged")) _submitType = SubmitType.LeaveUnchanged; if (spec.Contains("+reopen")) Reopen = true; } } /// /// Sets line-ending character(s) for client text files. /// [Flags] public enum LineEnd { /// /// mode that is native to the client (default). /// Local = 0x0000, /// /// linefeed: UNIX style. /// Unix = 0x0001, /// /// carriage return: Macintosh style. /// Mac = 0x0002, /// /// carriage return-linefeed: Windows style. /// Win = 0x0003, /// /// hybrid: writes UNIX style but reads UNIX, /// Mac or Windows style. /// Share = 0x0004 } /// /// A client specification in a Perforce repository. /// public class Client { // has the actual record been retrieved from the server public bool Initialized { get; set; } public void Initialize(Connection connection) { Initialized = false; if ((connection == null) || String.IsNullOrEmpty(Name)) { P4Exception.Throw(ErrorSeverity.E_FAILED, "Client cannot be initialized"); return; } Connection = connection; if (connection._p4server == null) { // not connected to the server yet return; } P4Command cmd = new P4Command(connection, "client", true, "-o", Name); P4CommandResult results = cmd.Run(); if ((results.Success) && (results.TaggedOutput != null) && (results.TaggedOutput.Count > 0)) { FromClientCmdTaggedOutput(results.TaggedOutput[0]); Initialized = true; } else { P4Exception.Throw(results.ErrorList); } } internal Connection Connection { get; private set; } internal FormBase _baseForm; public string Name { get; set; } public string OwnerName { get; set; } public string Host { get; set; } public string Description { get; set; } public DateTime Updated { get; set; } public DateTime Accessed { get; set; } public string Root { get; set; } public IList AltRoots { get; set; } private ClientOptionEnum _options; public ClientOption Options { get { return _options; } set { _options = (ClientOptionEnum) value; } } public ClientSubmitOptions SubmitOptions { get; set; } private StringEnum _lineEnd; public LineEnd LineEnd { get { return _lineEnd; } set { _lineEnd = value; } } public string Stream { get; set; } public string StreamAtChange { get; set; } public string ServerID { get; set; } public ViewMap ViewMap { get; set; } public FormSpec Spec { get; set; } #region fromTaggedOutput /// /// Parse the tagged output of a 'clients' command /// /// public void FromClientsCmdTaggedOutput(TaggedObject workspaceInfo, string offset, bool dst_mismatch) { Initialized = true; _baseForm = new FormBase(); _baseForm.SetValues(workspaceInfo); if (workspaceInfo.ContainsKey("client")) Name = workspaceInfo["client"]; else if (workspaceInfo.ContainsKey("Client")) Name = workspaceInfo["Client"]; if (workspaceInfo.ContainsKey("Update")) { long unixTime = 0; if (Int64.TryParse(workspaceInfo["Update"], out unixTime)) { DateTime UTC = FormBase.ConvertUnixTime(unixTime); DateTime GMT = new DateTime(UTC.Year, UTC.Month, UTC.Day, UTC.Hour, UTC.Minute, UTC.Second, DateTimeKind.Unspecified); Updated = FormBase.ConvertFromUTC(GMT, offset, dst_mismatch); } } if (workspaceInfo.ContainsKey("Access")) { long unixTime = 0; if (Int64.TryParse(workspaceInfo["Access"], out unixTime)) { DateTime UTC = FormBase.ConvertUnixTime(unixTime); DateTime GMT = new DateTime(UTC.Year, UTC.Month, UTC.Day, UTC.Hour, UTC.Minute, UTC.Second, DateTimeKind.Unspecified); Accessed = FormBase.ConvertFromUTC(GMT, offset, dst_mismatch); } } if (workspaceInfo.ContainsKey("Owner")) OwnerName = workspaceInfo["Owner"]; if (workspaceInfo.ContainsKey("Options")) { String optionsStr = workspaceInfo["Options"]; _options = optionsStr; } if (workspaceInfo.ContainsKey("SubmitOptions")) { SubmitOptions = workspaceInfo["SubmitOptions"]; } if (workspaceInfo.ContainsKey("LineEnd")) { _lineEnd = workspaceInfo["LineEnd"]; } if (workspaceInfo.ContainsKey("Root")) Root = workspaceInfo["Root"]; if (workspaceInfo.ContainsKey("Host")) Host = workspaceInfo["Host"]; if (workspaceInfo.ContainsKey("Description")) Description = workspaceInfo["Description"]; if (workspaceInfo.ContainsKey("Stream")) Stream = workspaceInfo["Stream"]; if (workspaceInfo.ContainsKey("StreamAtChange")) StreamAtChange = workspaceInfo["StreamAtChange"]; if (workspaceInfo.ContainsKey("ServerID")) ServerID = workspaceInfo["ServerID"]; int idx = 0; String key = String.Format("AltRoots{0}", idx); if (workspaceInfo.ContainsKey(key)) { AltRoots = new List(); while (workspaceInfo.ContainsKey(key)) { AltRoots.Add(workspaceInfo[key]); idx++; key = String.Format("AltRoots{0}", idx); } } idx = 0; key = String.Format("View{0}", idx); if (workspaceInfo.ContainsKey(key)) { ViewMap = new ViewMap(); while (workspaceInfo.ContainsKey(key)) { ViewMap.Add(workspaceInfo[key]); idx++; key = String.Format("View{0}", idx); } } else { ViewMap = null; } } /// /// Parse the tagged output of a 'client' command /// /// public void FromClientCmdTaggedOutput(TaggedObject workspaceInfo) { Initialized = true; _baseForm = new FormBase(); _baseForm.SetValues(workspaceInfo); if (workspaceInfo.ContainsKey("client")) Name = workspaceInfo["client"]; else if (workspaceInfo.ContainsKey("Client")) Name = workspaceInfo["Client"]; if (workspaceInfo.ContainsKey("Update")) { DateTime d; if (DateTime.TryParse(workspaceInfo["Update"], out d)) { Updated = d; } } if (workspaceInfo.ContainsKey("Access")) { DateTime d; if (DateTime.TryParse(workspaceInfo["Access"], out d)) { Accessed = d; } } if (workspaceInfo.ContainsKey("Owner")) OwnerName = workspaceInfo["Owner"]; if (workspaceInfo.ContainsKey("Options")) { String optionsStr = workspaceInfo["Options"]; _options = optionsStr; } if (workspaceInfo.ContainsKey("SubmitOptions")) { SubmitOptions = workspaceInfo["SubmitOptions"]; } if (workspaceInfo.ContainsKey("LineEnd")) { _lineEnd = workspaceInfo["LineEnd"]; } if (workspaceInfo.ContainsKey("Root")) Root = workspaceInfo["Root"]; if (workspaceInfo.ContainsKey("Host")) Host = workspaceInfo["Host"]; if (workspaceInfo.ContainsKey("Description")) Description = workspaceInfo["Description"]; if (workspaceInfo.ContainsKey("Stream")) Stream = workspaceInfo["Stream"]; if (workspaceInfo.ContainsKey("StreamAtChange")) StreamAtChange = workspaceInfo["StreamAtChange"]; if (workspaceInfo.ContainsKey("ServerID")) ServerID = workspaceInfo["ServerID"]; int idx = 0; String key = String.Format("AltRoots{0}", idx); if (workspaceInfo.ContainsKey(key)) { AltRoots = new List(); while (workspaceInfo.ContainsKey(key)) { AltRoots.Add(workspaceInfo[key]); idx++; key = String.Format("AltRoots{0}", idx); } } idx = 0; key = String.Format("View{0}", idx); if (workspaceInfo.ContainsKey(key)) { ViewMap = new ViewMap(); while (workspaceInfo.ContainsKey(key)) { ViewMap.Add(workspaceInfo[key]); idx++; key = String.Format("View{0}", idx); } } else { ViewMap = null; } } #endregion #region client spec support /// /// Parse a client spec /// /// /// public bool Parse(String spec) { _baseForm = new FormBase(); _baseForm.Parse(spec); // parse the values into the underlying dictionary if (_baseForm.ContainsKey("Client")) { Name = _baseForm["Client"] as string; } if (_baseForm.ContainsKey("Host")) { Host = _baseForm["Host"] as string; } if (_baseForm.ContainsKey("Owner")) { OwnerName = _baseForm["Owner"] as string; } if (_baseForm.ContainsKey("Root")) { Root = _baseForm["Root"] as string; } if (_baseForm.ContainsKey("Description")) { if (_baseForm["Description"] is IList) { IList strList = _baseForm["Description"] as IList; Description = string.Empty; for (int idx = 0; idx < strList.Count; idx++) { if (idx > 0) { Description += "\r\n"; } Description += strList[idx]; } } else if (_baseForm["Description"] is SimpleList) { SimpleList strList = _baseForm["Description"] as SimpleList; Description = string.Empty; SimpleListItem current = strList.Head; bool addCRLF = false; while (current != null) { if (addCRLF) { Description += "\r\n"; } else { addCRLF = true; } Description += current.Item; current = current.Next; } } } if (_baseForm.ContainsKey("AltRoots")) { if (_baseForm["AltRoots"] is IList) { AltRoots = _baseForm["AltRoots"] as IList; } else if (_baseForm["AltRoots"] is SimpleList) { AltRoots = (List) ((SimpleList) _baseForm["AltRoots"]); } } if (_baseForm.ContainsKey("View")) { if (_baseForm["View"] is IList) { IList lines = _baseForm["View"] as IList; ViewMap = new ViewMap(lines.ToArray()); } else if (_baseForm["View"] is SimpleList) { SimpleList lines = _baseForm["View"] as SimpleList; ViewMap = new ViewMap(lines.ToArray()); } } if (_baseForm.ContainsKey("Update")) { DateTime d; if (DateTime.TryParse(_baseForm["Update"] as string, out d)) { Updated = d; } } if (_baseForm.ContainsKey("Access")) { DateTime d; if (DateTime.TryParse(_baseForm["Access"] as string, out d)) { Accessed = d; } } if (_baseForm.ContainsKey("Options")) { _options = _baseForm["Options"] as string; } if (_baseForm.ContainsKey("SubmitOptions")) { SubmitOptions = _baseForm["SubmitOptions"] as string; } if (_baseForm.ContainsKey("LineEnd")) { _lineEnd = _baseForm["LineEnd"] as string; } if (_baseForm.ContainsKey("Stream")) { Stream = _baseForm["Stream"] as string; } if (_baseForm.ContainsKey("StreamAtChange")) { StreamAtChange = _baseForm["StreamAtChange"] as string; } if (_baseForm.ContainsKey("ServerID")) { ServerID = _baseForm["ServerID"] as string; } return true; } private static String ClientSpecFormat = "Client:\t{0}\n" + "\n" + "Update:\t{1}\n" + "\n" + "Access:\t{2}\n" + "\n" + "Owner:\t{3}\n" + "\n" + "Host:\t{4}\n" + "\n" + "Description:\n" + "\t{5}\n" + "\n" + "Root:\t{6}\n" + "\n" + "AltRoots:\n" + "\t{7}\n" + "\n" + "Options:\t{8}\n" + "\n" + "SubmitOptions:\t{9}\n" + "\n" + "LineEnd:\t{10}\n" + "\n" + "{11}"+ "{12}" + "{13}" + "View:\n" + "\t{14}\n"; private String AltRootsStr { get { String value = String.Empty; if ((AltRoots != null) && (AltRoots.Count > 0)) { for (int idx = 0; idx < AltRoots.Count; idx++) { value += AltRoots[idx] + "\r\n"; } } return value; } } /// /// Utility function to format a DateTime in the format expected in a spec /// /// /// public static String FormatDateTime(DateTime dt) { if ((dt != null) && (DateTime.MinValue != dt)) return dt.ToString("yyyy/MM/dd HH:mm:ss"); return string.Empty; } /// /// Format as a client spec /// /// override public String ToString() { String tmpDescStr = String.Empty; if (!String.IsNullOrEmpty(Description)) { tmpDescStr = FormBase.FormatMultilineField(Description.ToString()); } String tmpAltRootsStr = String.Empty; if (!String.IsNullOrEmpty(AltRootsStr)) { tmpAltRootsStr = FormBase.FormatMultilineField(AltRootsStr.ToString()); } String tmpViewStr = String.Empty; if (ViewMap != null) { tmpViewStr = FormBase.FormatMultilineField(ViewMap.ToString()); } String tmpStreamStr = String.Empty; if (Stream != null) { tmpStreamStr = FormBase.FormatMultilineField(Stream.ToString()); tmpStreamStr = "Stream:\t"+tmpStreamStr+"\n" + "\n"; } String tmpStreamAtChangeStr = String.Empty; if (StreamAtChange != null) { tmpStreamAtChangeStr = FormBase.FormatMultilineField(StreamAtChange.ToString()); tmpStreamAtChangeStr = "StreamAtChange:\t" + tmpStreamAtChangeStr + "\n" + "\n"; } String tmpServerIDStr = String.Empty; if (ServerID != null) { tmpServerIDStr = FormBase.FormatMultilineField(ServerID.ToString()); tmpServerIDStr = "ServerID:\t" + tmpServerIDStr + "\n" + "\n"; } String value = String.Format(ClientSpecFormat, Name, FormatDateTime(Updated), FormatDateTime(Accessed), OwnerName, Host, tmpDescStr, Root, tmpAltRootsStr, _options.ToString(), SubmitOptions.ToString(), _lineEnd.ToString(), tmpStreamStr, tmpStreamAtChangeStr, tmpServerIDStr, tmpViewStr); return value; } #endregion #region operations internal List runFileListCmd(string cmdName, Options options, params FileSpec[] files) { return runFileListCmd(cmdName, options, null, files); } internal List runFileListCmd(string cmdName, Options options, string commandData, params FileSpec[] files) { string[] paths = null; P4Command cmd = null; if (files != null) { if (cmdName == "add") { paths = FileSpec.ToStrings(files); } else { paths = FileSpec.ToEscapedStrings(files); } cmd = new P4Command(Connection, cmdName, true, paths); } else { cmd = new P4Command(Connection, cmdName, true); } if (String.IsNullOrEmpty(commandData) == false) { cmd.DataSet = commandData; } P4CommandResult results = cmd.Run(options); if (results.Success) { if ((results.TaggedOutput == null) || (results.TaggedOutput.Count <= 0)) { return null; } List newDepotFiles = new List(); foreach (TaggedObject obj in results.TaggedOutput) { FileSpec spec = null; int rev = -1; string p; DepotPath dp = null; ClientPath cp = null; LocalPath lp = null; if (obj.ContainsKey("workRev")) { int.TryParse(obj["workRev"], out rev); } else if (obj.ContainsKey("haveRev")) { int.TryParse(obj["haveRev"], out rev); } else if (obj.ContainsKey("rev")) { int.TryParse(obj["rev"], out rev); } if (obj.ContainsKey("depotFile")) { p = obj["depotFile"]; dp = new DepotPath(PathSpec.UnescapePath(p)); } if (obj.ContainsKey("clientFile")) { p = obj["clientFile"]; if (p.StartsWith("//")) { cp = new ClientPath(PathSpec.UnescapePath(p)); } else { cp = new ClientPath(PathSpec.UnescapePath(p)); lp = new LocalPath(PathSpec.UnescapePath(p)); } } if (obj.ContainsKey("path")) { lp = new LocalPath(obj["path"]); } spec = new FileSpec(dp, cp, lp, new Revision(rev)); newDepotFiles.Add(spec); } return newDepotFiles; } else { P4Exception.Throw(results.ErrorList); } return null; } /// /// /// /// /// /// /// ///
p4 help add ///
///
add -- Open a new file to add it to the depot ///
///
p4 add [-c changelist#] [-d -f -n] [-t filetype] file ... ///
///
Open a file for adding to the depot. If the file exists on the ///
client, it is read to determine if it is text or binary. If it does ///
not exist, it is assumed to be text. To be added, the file must not ///
already reside in the depot, or it must be deleted at the current ///
head revision. Files can be deleted and re-added. ///
///
To associate the open files with a specific pending changelist, use ///
the -c flag; if you omit the -c flag, the open files are associated ///
with the default changelist. If file is already open, it is moved ///
into the specified pending changelist. You cannot reopen a file for ///
add unless it is already open for add. ///
///
As a shortcut to reverting and re-adding, you can use the -d ///
flag to reopen currently-open files for add (downgrade) under ///
the following circumstances: ///
///
A file that is 'opened for edit' and is synced to the head ///
revision, and the head revision has been deleted (or moved). ///
///
A file that is 'opened for move/add' can be downgraded to add, ///
which is useful when the source of the move has been deleted ///
or moved. Typically, under these circumstances, your only ///
alternative is to revert. In this case, breaking the move ///
connection enables you to preserve any content changes in the ///
new file and safely revert the source file (of the move). ///
///
To specify file type, use the -t flag. By default, 'p4 add' ///
determines file type using the name-to-type mapping table managed ///
by 'p4 typemap' and by examining the file's contents and execute ///
permission bit. If the file type specified by -t or configured in ///
the typemap table is a partial filetype, the resulting modifier is ///
applied to the file type that is determined by 'p4 add'. For more ///
details, see 'p4 help filetypes'. ///
///
To add files with filenames that contain wildcard characters, specify ///
the -f flag. Filenames that contain the special characters '@', '#', ///
'%' or '*' are reformatted to encode the characters using ASCII ///
hexadecimal representation. After the files are added, you must ///
refer to them using the reformatted file name, because Perforce ///
does not recognize the local filesystem name. ///
///
The -n flag displays a preview of the specified add operation without ///
changing any files or metadata. ///
///
///
public IList AddFiles(Options options, params FileSpec[] files) { return runFileListCmd("add", options, files); } public IList AddFiles(IList toFiles, Options options) { return AddFiles(options, toFiles.ToArray()); } /// /// /// /// /// /// /// ///
p4 help delete ///
///
delete -- Open an existing file for deletion from the depot ///
///
p4 delete [-c changelist#] [-n -v -k] file ... ///
///
Opens a depot file for deletion. ///
If the file is synced in the client workspace, it is removed. If a ///
pending changelist number is specified using with the -c flag, the ///
file is opened for delete in that changelist. Otherwise, it is opened ///
in the default pending changelist. ///
///
Files that are deleted generally do not appear on the have list. ///
///
The -n flag displays a preview of the operation without changing any ///
files or metadata. ///
///
The -v flag enables you to delete files that are not synced to the ///
client workspace. ///
///
The -k flag performs the delete on the server without modifying ///
client files. Use with caution, as an incorrect delete can cause ///
discrepancies between the state of the client and the corresponding ///
server metadata. ///
///
public IList DeleteFiles(Options options, params FileSpec[] files) { return runFileListCmd("delete", options, files); } public IList DeleteFiles(IList toFiles, Options options) { return DeleteFiles(options, toFiles.ToArray()); } /// /// /// /// /// /// /// ///
p4 help edit ///
///
edit -- Open an existing file for edit ///
///
p4 edit [-c changelist#] [-k -n] [-t filetype] file ... ///
///
Open an existing file for edit. The server records the fact that ///
the current user has opened the file in the current workspace, and ///
changes the file permission from read-only to read/write. ///
///
If -c changelist# is included, the file opened in the specified ///
pending changelist. If changelist number is omitted, the file is ///
opened in the 'default' changelist. ///
///
If -t filetype is specified, the file is assigned that Perforce ///
filetype. Otherwise, the filetype of the previous revision is reused. ///
If a partial filetype is specified, it is combined with the current ///
filetype.For details, see 'p4 help filetypes'. ///
Using a filetype of 'auto' will cause the filetype to be choosen ///
as if the file were being added, that is the typemap will be ///
considered and the file contents may be examined. ///
///
The -n flag previews the operation without changing any files or ///
metadata. ///
///
The -k flag updates metadata without transferring files to the ///
workspace. This option can be used to tell the server that files in ///
a client workspace are already editable, even if they are not in the ///
client view. Typically this flag is used to correct the Perforce ///
server when it is wrong about the state of files in the client ///
workspace, but incorrect use of this option can result in inaccurate ///
file status information. ///
///
///
public IList EditFiles(Options options, params FileSpec[] files) { return runFileListCmd("edit", options, files); } public IList EditFiles(IList toFiles, Options options) { return EditFiles(options, toFiles.ToArray()); } /// /// /// /// /// /// /// ///
p4 help have ///
///
have -- List the revisions most recently synced to the current workspace ///
///
p4 have [file ...] ///
///
List revision numbers of the currently-synced files. If file name is ///
omitted, list all files synced to this client workspace. ///
///
The format is: depot-file#revision - client-file ///
///
///
public IList GetSyncedFiles(Options options, params FileSpec[] files) { if (options != null) { throw new ArgumentException("GetSynchedFiles has no valid options", "options"); } return runFileListCmd("have", options, files); } public IList GetSyncedFiles(IList toFiles, Options options) { return GetSyncedFiles(options, toFiles.ToArray()); } /// /// /// /// /// /// /// ///
p4 help integrate ///
///
integrate -- Integrate one set of files into another ///
///
p4 integrate [options] fromFile[revRange] toFile ///
p4 integrate [options] -b branch [-r] [toFile[revRange] ...] ///
p4 integrate [options] -b branch -s fromFile[revRange] [toFile ...] ///
p4 integrate [options] -S stream [-r] [-P parent] [file[revRange] ...] ///
///
options: -c changelist# -d -f -h -i -o -n -m max -t -v ///
-D<flags> -R<flags> ///
///
'p4 integrate' integrates one set of files (the 'source') into ///
another (the 'target'). ///
///
(See also 'p4 merge' and 'p4 copy', variants of 'p4 integrate' that ///
may be easier and more effective for the task at hand.) ///
///
Using the client workspace as a staging area, 'p4 integrate' adds and ///
deletes target files per changes in the source, and schedules all ///
other affected target files to be resolved. Target files outside of ///
the current client view are not affected. Source files need not be ///
within the client view. ///
///
'p4 resolve' must be used to merge file content, and to resolve ///
filename and filetype changes. 'p4 submit' commits integrated files ///
to the depot. Unresolved files may not be submitted. Integrations ///
can be shelved with 'p4 shelve' and abandoned with 'p4 revert'. The ///
commands 'p4 integrated' and 'p4 filelog' display integration history. ///
///
When 'p4 integrate' schedules a workspace file to be resolved, it ///
leaves it read-only. 'p4 resolve' can operate on a read-only file. ///
For other pre-submit changes, 'p4 edit' must be used to make the ///
file writable. ///
///
Source and target files can be specified either on the 'p4 integrate' ///
command line or through a branch view. On the command line, fromFile ///
is the source file set and toFile is the target file set. With a ///
branch view, one or more toFile arguments can be given to limit the ///
scope of the target file set. ///
///
revRange is a revision or a revision range that limits the span of ///
source history to be probed for unintegrated revisions. revRange ///
can be used on fromFile, or on toFile, but not on both. When used on ///
toFile, it refers to source revisions, not to target revisions. For ///
details about revision specifiers, see 'p4 help revisions'. ///
///
The -S flag makes 'p4 integrate' use a stream's branch view. (See ///
'p4 help stream'.) The source is the stream itself, and the target is ///
the stream's parent. With -r, the direction is reversed. -P can be ///
used to specify a parent stream other than the stream's actual parent. ///
Note that to submit integrated stream files, the current client must ///
be dedicated to the target stream. (See 'p4 help client'.) ///
///
The -b flag makes 'p4 integrate' use a user-defined branch view. ///
(See 'p4 help branch'.) The source is the left side of the branch view ///
and the target is the right side. With -r, the direction is reversed. ///
///
The -s flag can be used with -b to cause fromFile to be treated as ///
the source, and both sides of the branch view to be treated as the ///
target, per the branch view mapping. Optional toFile arguments may ///
be given to further restrict the scope of the target file set. The ///
-r flag is ignored when -s is used. ///
///
Note that 'p4 integrate' automatically adusts source-to-target ///
mappings for moved and renamed files. (Adjustment occurs only if ///
the 'p4 move' command was used to move/rename files.) The scope of ///
source and target file sets must include both the old-named and the ///
new-named files for mappings to be adjusted. Moved source files may ///
cause target files to be scheduled for filename resolves. ///
///
The -f flag forces integrate to ignore integration history and treat ///
all source revisions as unintegrated. It is meant to be used with ///
revRange to force reintegration of specific, previously integrated ///
revisions. ///
///
The -i flag enables merging between files that have no prior ///
integration history. By default, 'p4 integrate' requires a prior ///
integration in order to identify a base for merging. The -i flag ///
allows the integration, and schedules the target file to be resolved ///
using the first source revision as the merge base. ///
///
The -o flag causes more merge information to be output. For each ///
target file scheduled to be resolved, the base file revision and the ///
source file revision are shown. (After running 'p4 integrate', the ///
same information is available from 'p4 resolve -o'.) ///
///
The -R flags modify the way resolves are scheduled: ///
///
-Rb Schedules 'branch resolves' instead of branching new ///
target files automatically. ///
///
-Rd Schedules 'delete resolves' instead of deleting ///
target files automatically. ///
///
-Rs Skips cherry-picked revisions already integrated. ///
This can improve merge results, but can also cause ///
multiple resolves per file to be scheduled. ///
///
The -D flags modify the way deleted files are treated: ///
///
-Dt If the target file has been deleted and the source ///
file has changed, re-branch the source file on top ///
of the target file instead of scheduling a resolve. ///
///
-Ds If the source file has been deleted and the target ///
file has changed, delete the target file instead of ///
scheduling a resolve. ///
///
-Di If the source file has been deleted and re-added, ///
probe revisions that precede the deletion to find ///
unintegrated revisions. By default, 'p4 integrate' ///
starts probing at the last re-added revision. ///
///
The -d flag is a shorthand for all -D flags used together. ///
///
The -h flag leaves the target files at the revision currently synced ///
to the client (the '#have' revision). By default, target files are ///
automatically synced to the head revision by 'p4 integrate'. ///
///
The -t flag propagates source filetypes instead of scheduling ///
filetype conflicts to be resolved. ///
///
The -m flag limits integration to the first 'max' number of files. ///
///
The -n flag displays a preview of integration, without actually ///
doing anything. ///
///
If -c changelist# is specified, the files are opened in the ///
designated numbered pending changelist instead of the 'default' ///
changelist. ///
///
The -v flag causes a 'virtual' integration that does not modify ///
client workspace files unless target files need to be resolved. ///
After submitting a virtual integration, 'p4 sync' can be used to ///
update the workspace. ///
///
///
public IList IntegrateFiles(Options options, params FileSpec[] files) { return runFileListCmd("integrate", options, files); } public IList IntegrateFiles(IList toFiles, Options options) { return IntegrateFiles(options, toFiles.ToArray()); } /// /// /// /// /// /// /// /// ///
p4 help integrate ///
///
integrate -- Integrate one set of files into another ///
///
p4 integrate [options] fromFile[revRange] toFile ///
p4 integrate [options] -b branch [-r] [toFile[revRange] ...] ///
p4 integrate [options] -b branch -s fromFile[revRange] [toFile ...] ///
p4 integrate [options] -S stream [-r] [-P parent] [file[revRange] ...] ///
///
options: -c changelist# -d -f -h -i -o -n -m max -t -v ///
-D<flags> -R<flags> ///
///
'p4 integrate' integrates one set of files (the 'source') into ///
another (the 'target'). ///
///
(See also 'p4 merge' and 'p4 copy', variants of 'p4 integrate' that ///
may be easier and more effective for the task at hand.) ///
///
Using the client workspace as a staging area, 'p4 integrate' adds and ///
deletes target files per changes in the source, and schedules all ///
other affected target files to be resolved. Target files outside of ///
the current client view are not affected. Source files need not be ///
within the client view. ///
///
'p4 resolve' must be used to merge file content, and to resolve ///
filename and filetype changes. 'p4 submit' commits integrated files ///
to the depot. Unresolved files may not be submitted. Integrations ///
can be shelved with 'p4 shelve' and abandoned with 'p4 revert'. The ///
commands 'p4 integrated' and 'p4 filelog' display integration history. ///
///
When 'p4 integrate' schedules a workspace file to be resolved, it ///
leaves it read-only. 'p4 resolve' can operate on a read-only file. ///
For other pre-submit changes, 'p4 edit' must be used to make the ///
file writable. ///
///
Source and target files can be specified either on the 'p4 integrate' ///
command line or through a branch view. On the command line, fromFile ///
is the source file set and toFile is the target file set. With a ///
branch view, one or more toFile arguments can be given to limit the ///
scope of the target file set. ///
///
revRange is a revision or a revision range that limits the span of ///
source history to be probed for unintegrated revisions. revRange ///
can be used on fromFile, or on toFile, but not on both. When used on ///
toFile, it refers to source revisions, not to target revisions. For ///
details about revision specifiers, see 'p4 help revisions'. ///
///
The -S flag makes 'p4 integrate' use a stream's branch view. (See ///
'p4 help stream'.) The source is the stream itself, and the target is ///
the stream's parent. With -r, the direction is reversed. -P can be ///
used to specify a parent stream other than the stream's actual parent. ///
Note that to submit integrated stream files, the current client must ///
be dedicated to the target stream. (See 'p4 help client'.) ///
///
The -b flag makes 'p4 integrate' use a user-defined branch view. ///
(See 'p4 help branch'.) The source is the left side of the branch view ///
and the target is the right side. With -r, the direction is reversed. ///
///
The -s flag can be used with -b to cause fromFile to be treated as ///
the source, and both sides of the branch view to be treated as the ///
target, per the branch view mapping. Optional toFile arguments may ///
be given to further restrict the scope of the target file set. The ///
-r flag is ignored when -s is used. ///
///
Note that 'p4 integrate' automatically adusts source-to-target ///
mappings for moved and renamed files. (Adjustment occurs only if ///
the 'p4 move' command was used to move/rename files.) The scope of ///
source and target file sets must include both the old-named and the ///
new-named files for mappings to be adjusted. Moved source files may ///
cause target files to be scheduled for filename resolves. ///
///
The -f flag forces integrate to ignore integration history and treat ///
all source revisions as unintegrated. It is meant to be used with ///
revRange to force reintegration of specific, previously integrated ///
revisions. ///
///
The -i flag enables merging between files that have no prior ///
integration history. By default, 'p4 integrate' requires a prior ///
integration in order to identify a base for merging. The -i flag ///
allows the integration, and schedules the target file to be resolved ///
using the first source revision as the merge base. ///
///
The -o flag causes more merge information to be output. For each ///
target file scheduled to be resolved, the base file revision and the ///
source file revision are shown. (After running 'p4 integrate', the ///
same information is available from 'p4 resolve -o'.) ///
///
The -R flags modify the way resolves are scheduled: ///
///
-Rb Schedules 'branch resolves' instead of branching new ///
target files automatically. ///
///
-Rd Schedules 'delete resolves' instead of deleting ///
target files automatically. ///
///
-Rs Skips cherry-picked revisions already integrated. ///
This can improve merge results, but can also cause ///
multiple resolves per file to be scheduled. ///
///
The -D flags modify the way deleted files are treated: ///
///
-Dt If the target file has been deleted and the source ///
file has changed, re-branch the source file on top ///
of the target file instead of scheduling a resolve. ///
///
-Ds If the source file has been deleted and the target ///
file has changed, delete the target file instead of ///
scheduling a resolve. ///
///
-Di If the source file has been deleted and re-added, ///
probe revisions that precede the deletion to find ///
unintegrated revisions. By default, 'p4 integrate' ///
starts probing at the last re-added revision. ///
///
The -d flag is a shorthand for all -D flags used together. ///
///
The -h flag leaves the target files at the revision currently synced ///
to the client (the '#have' revision). By default, target files are ///
automatically synced to the head revision by 'p4 integrate'. ///
///
The -t flag propagates source filetypes instead of scheduling ///
filetype conflicts to be resolved. ///
///
The -m flag limits integration to the first 'max' number of files. ///
///
The -n flag displays a preview of integration, without actually ///
doing anything. ///
///
If -c changelist# is specified, the files are opened in the ///
designated numbered pending changelist instead of the 'default' ///
changelist. ///
///
The -v flag causes a 'virtual' integration that does not modify ///
client workspace files unless target files need to be resolved. ///
After submitting a virtual integration, 'p4 sync' can be used to ///
update the workspace. ///
///
///
public IList IntegrateFiles(FileSpec fromFile, Options options, params FileSpec[] toFiles) { FileSpec[] newParams = new FileSpec[toFiles.Length + 1]; newParams[0] = fromFile; for (int idx = 0; idx < toFiles.Length; idx++) { newParams[idx + 1] = toFiles[idx]; } return runFileListCmd("integrate", options, newParams); } /// /// /// /// /// /// /// /// ///
p4 help integrate ///
///
integrate -- Integrate one set of files into another ///
///
p4 integrate [options] fromFile[revRange] toFile ///
p4 integrate [options] -b branch [-r] [toFile[revRange] ...] ///
p4 integrate [options] -b branch -s fromFile[revRange] [toFile ...] ///
p4 integrate [options] -S stream [-r] [-P parent] [file[revRange] ...] ///
///
options: -c changelist# -d -f -h -i -o -n -m max -t -v ///
-D<flags> -R<flags> ///
///
'p4 integrate' integrates one set of files (the 'source') into ///
another (the 'target'). ///
///
(See also 'p4 merge' and 'p4 copy', variants of 'p4 integrate' that ///
may be easier and more effective for the task at hand.) ///
///
Using the client workspace as a staging area, 'p4 integrate' adds and ///
deletes target files per changes in the source, and schedules all ///
other affected target files to be resolved. Target files outside of ///
the current client view are not affected. Source files need not be ///
within the client view. ///
///
'p4 resolve' must be used to merge file content, and to resolve ///
filename and filetype changes. 'p4 submit' commits integrated files ///
to the depot. Unresolved files may not be submitted. Integrations ///
can be shelved with 'p4 shelve' and abandoned with 'p4 revert'. The ///
commands 'p4 integrated' and 'p4 filelog' display integration history. ///
///
When 'p4 integrate' schedules a workspace file to be resolved, it ///
leaves it read-only. 'p4 resolve' can operate on a read-only file. ///
For other pre-submit changes, 'p4 edit' must be used to make the ///
file writable. ///
///
Source and target files can be specified either on the 'p4 integrate' ///
command line or through a branch view. On the command line, fromFile ///
is the source file set and toFile is the target file set. With a ///
branch view, one or more toFile arguments can be given to limit the ///
scope of the target file set. ///
///
revRange is a revision or a revision range that limits the span of ///
source history to be probed for unintegrated revisions. revRange ///
can be used on fromFile, or on toFile, but not on both. When used on ///
toFile, it refers to source revisions, not to target revisions. For ///
details about revision specifiers, see 'p4 help revisions'. ///
///
The -S flag makes 'p4 integrate' use a stream's branch view. (See ///
'p4 help stream'.) The source is the stream itself, and the target is ///
the stream's parent. With -r, the direction is reversed. -P can be ///
used to specify a parent stream other than the stream's actual parent. ///
Note that to submit integrated stream files, the current client must ///
be dedicated to the target stream. (See 'p4 help client'.) ///
///
The -b flag makes 'p4 integrate' use a user-defined branch view. ///
(See 'p4 help branch'.) The source is the left side of the branch view ///
and the target is the right side. With -r, the direction is reversed. ///
///
The -s flag can be used with -b to cause fromFile to be treated as ///
the source, and both sides of the branch view to be treated as the ///
target, per the branch view mapping. Optional toFile arguments may ///
be given to further restrict the scope of the target file set. The ///
-r flag is ignored when -s is used. ///
///
Note that 'p4 integrate' automatically adusts source-to-target ///
mappings for moved and renamed files. (Adjustment occurs only if ///
the 'p4 move' command was used to move/rename files.) The scope of ///
source and target file sets must include both the old-named and the ///
new-named files for mappings to be adjusted. Moved source files may ///
cause target files to be scheduled for filename resolves. ///
///
The -f flag forces integrate to ignore integration history and treat ///
all source revisions as unintegrated. It is meant to be used with ///
revRange to force reintegration of specific, previously integrated ///
revisions. ///
///
The -i flag enables merging between files that have no prior ///
integration history. By default, 'p4 integrate' requires a prior ///
integration in order to identify a base for merging. The -i flag ///
allows the integration, and schedules the target file to be resolved ///
using the first source revision as the merge base. ///
///
The -o flag causes more merge information to be output. For each ///
target file scheduled to be resolved, the base file revision and the ///
source file revision are shown. (After running 'p4 integrate', the ///
same information is available from 'p4 resolve -o'.) ///
///
The -R flags modify the way resolves are scheduled: ///
///
-Rb Schedules 'branch resolves' instead of branching new ///
target files automatically. ///
///
-Rd Schedules 'delete resolves' instead of deleting ///
target files automatically. ///
///
-Rs Skips cherry-picked revisions already integrated. ///
This can improve merge results, but can also cause ///
multiple resolves per file to be scheduled. ///
///
The -D flags modify the way deleted files are treated: ///
///
-Dt If the target file has been deleted and the source ///
file has changed, re-branch the source file on top ///
of the target file instead of scheduling a resolve. ///
///
-Ds If the source file has been deleted and the target ///
file has changed, delete the target file instead of ///
scheduling a resolve. ///
///
-Di If the source file has been deleted and re-added, ///
probe revisions that precede the deletion to find ///
unintegrated revisions. By default, 'p4 integrate' ///
starts probing at the last re-added revision. ///
///
The -d flag is a shorthand for all -D flags used together. ///
///
The -h flag leaves the target files at the revision currently synced ///
to the client (the '#have' revision). By default, target files are ///
automatically synced to the head revision by 'p4 integrate'. ///
///
The -t flag propagates source filetypes instead of scheduling ///
filetype conflicts to be resolved. ///
///
The -m flag limits integration to the first 'max' number of files. ///
///
The -n flag displays a preview of integration, without actually ///
doing anything. ///
///
If -c changelist# is specified, the files are opened in the ///
designated numbered pending changelist instead of the 'default' ///
changelist. ///
///
The -v flag causes a 'virtual' integration that does not modify ///
client workspace files unless target files need to be resolved. ///
After submitting a virtual integration, 'p4 sync' can be used to ///
update the workspace. ///
///
///
public IList IntegrateFiles(IList toFiles, FileSpec fromFile, Options options) { return IntegrateFiles(fromFile, options, toFiles.ToArray()); } /// /// /// /// /// /// /// ///
p4 help labelsync ///
///
labelsync -- Apply the label to the contents of the client workspace ///
///
p4 labelsync [-a -d -n -q] -l label [file[revRange] ...] ///
///
Labelsync causes the specified label to reflect the current contents ///
of the client. It records the revision of each file currently synced. ///
The label's name can subsequently be used in a revision specification ///
as @label to refer to the revision of a file as stored in the label. ///
///
Without a file argument, labelsync causes the label to reflect the ///
contents of the whole client, by adding, deleting, and updating the ///
label. If a file is specified, labelsync updates the specified file. ///
///
If the file argument includes a revision specification, that revision ///
is used instead of the revision synced by the client. If the specified ///
revision is a deleted revision, the label includes that deleted ///
revision. See 'p4 help revisions' for details about specifying ///
revisions. ///
///
If the file argument includes a revision range specification, ///
only files selected by the revision range are updated, and the ///
highest revision in the range is used. ///
///
The -a flag adds the specified file to the label. ///
///
The -d deletes the specified file from the label, regardless of ///
revision. ///
///
The -n flag previews the operation without altering the label. ///
///
Only the owner of a label can run labelsync on that label. A label ///
that has its Options: field set to 'locked' cannot be updated. ///
///
The -q flag suppresses normal output messages. Messages regarding ///
errors or exceptional conditions are displayed. ///
///
///
public IList LabelSync(Options options, string labelName, params FileSpec[] files) { if (String.IsNullOrEmpty(labelName)) { throw new ArgumentNullException("labelName"); } else { if (options == null) { options = new Options(); } options["-l"] = labelName; } return runFileListCmd("labelsync", options, files); } /// /// /// /// /// /// /// /// ///
p4 help labelsync ///
///
labelsync -- Apply the label to the contents of the client workspace ///
///
p4 labelsync [-a -d -n -q] -l label [file[revRange] ...] ///
///
Labelsync causes the specified label to reflect the current contents ///
of the client. It records the revision of each file currently synced. ///
The label's name can subsequently be used in a revision specification ///
as @label to refer to the revision of a file as stored in the label. ///
///
Without a file argument, labelsync causes the label to reflect the ///
contents of the whole client, by adding, deleting, and updating the ///
label. If a file is specified, labelsync updates the specified file. ///
///
If the file argument includes a revision specification, that revision ///
is used instead of the revision synced by the client. If the specified ///
revision is a deleted revision, the label includes that deleted ///
revision. See 'p4 help revisions' for details about specifying ///
revisions. ///
///
If the file argument includes a revision range specification, ///
only files selected by the revision range are updated, and the ///
highest revision in the range is used. ///
///
The -a flag adds the specified file to the label. ///
///
The -d deletes the specified file from the label, regardless of ///
revision. ///
///
The -n flag previews the operation without altering the label. ///
///
Only the owner of a label can run labelsync on that label. A label ///
that has its Options: field set to 'locked' cannot be updated. ///
///
The -q flag suppresses normal output messages. Messages regarding ///
errors or exceptional conditions are displayed. ///
///
///
public IList LabelSync(IList toFiles, string labelName, Options options) { return LabelSync(options, labelName, toFiles.ToArray()); } /// /// /// /// /// /// /// ///
p4 help lock ///
///
lock -- Lock an open file to prevent it from being submitted ///
///
p4 lock [-c changelist#] [file ...] ///
///
The specified files are locked in the depot, preventing any user ///
other than the current user on the current client from submitting ///
changes to the files. If a file is already locked, the lock request ///
is rejected. If no file names are specified, all files in the ///
specified changelist are locked. If changelist number is omitted, ///
files in the default changelist are locked. ///
///
///
public IList LockFiles(Options options, params FileSpec[] files) { return runFileListCmd("lock", options, files); } public IList LockFiles(IList files, Options options) { return LockFiles(options, files.ToArray()); } /// /// /// /// /// /// /// ///
p4 help move ///
///
move -- move file(s) from one location to another ///
rename -- synonym for 'move' ///
///
p4 move [-c changelist#] [-f -n -k] [-t filetype] fromFile toFile ///
///
Move takes an already opened file and moves it from one client ///
location to another, reopening it as a pending depot move. When ///
the file is submitted with 'p4 submit', its depot file is moved ///
accordingly. ///
///
Wildcards in fromFile and toFile must match. The fromFile must be ///
a file open for add or edit. ///
///
'p4 opened' lists pending moves. 'p4 diff' can compare a moved ///
client file with its depot original, 'p4 sync' can schedule an ///
update of a moved file, and 'p4 resolve' can resolve the update. ///
///
A client file can be moved many times before it is submitted. ///
Moving a file back to its original location will undo a pending ///
move, leaving unsubmitted content intact. Using 'p4 revert' ///
undoes the move and reverts the unsubmitted content. ///
///
If -c changelist# is specified, the file is reopened in the ///
specified pending changelist as well as being moved. ///
///
The -f flag forces a move to an existing target file. The file ///
must be synced and not opened. The originating source file will ///
no longer be synced to the client. ///
///
If -t filetype is specified, the file is assigned that filetype. ///
If the filetype is a partial filetype, the partial filetype is ///
combined with the current filetype. See 'p4 help filetypes'. ///
///
The -n flag previews the operation without moving files. ///
///
The -k flag performs the rename on the server without modifying ///
client files. Use with caution, as an incorrect move can cause ///
discrepancies between the state of the client and the corresponding ///
server metadata. ///
///
The 'move' command requires a release 2009.1 or newer client. The ///
'-f' flag requires a 2010.1 client. ///
///
///
public IList MoveFiles(FileSpec fromFile, FileSpec toFile, Options options) { return runFileListCmd("move", options, fromFile, toFile); } /// /// /// /// /// /// /// ///
p4 help reopen ///
///
reopen -- Change the filetype of an open file or move it to ///
another changelist ///
///
p4 reopen [-c changelist#] [-t filetype] file ... ///
///
Reopen an open file for the current user in order to move it to a ///
different changelist or change its filetype. ///
///
The target changelist must exist; you cannot create a changelist by ///
reopening a file. To move a file to the default changelist, use ///
'p4 reopen -c default'. ///
///
If -t filetype is specified, the file is assigned that filetype. If ///
a partial filetype is specified, it is combined with the current ///
filetype. For details, see 'p4 help filetypes'. ///
///
///
public IList ReopenFiles(Options options, params FileSpec[] files) { FileSpec[] temp = new P4.FileSpec[files.Length]; for (int idx = 0; idx < files.Length; idx++) { temp[idx] = new P4.FileSpec(files[idx]); temp[idx].Version = null; } return runFileListCmd("reopen", options, temp); } public IList ReopenFiles(IList files, Options options) { return ReopenFiles(options, files.ToArray()); } /// /// /// /// /// /// /// ///
p4 help resolve ///
///
resolve -- Resolve integrations and updates to workspace files ///
///
p4 resolve [options] [file ...] ///
///
options: -A<flags> -a<flags> -d<flags> -f -n -N -o -t -v ///
-c changelist# ///
///
'p4 resolve' resolves changes to files in the client workspace. ///
///
'p4 resolve' works only on files that have been scheduled to be ///
resolved. The commands that can schedule resolves are: 'p4 sync', ///
'p4 update', 'p4 submit', 'p4 merge', and 'p4 integrate'. Files must ///
be resolved before they can be submitted. ///
///
Resolving involves two sets of files, a source and a target. The ///
target is a set of depot files that maps to opened files in the ///
client workspace. When resolving an integration, the source is a ///
different set of depot files than the target. When resolving an ///
update, the source is the same set of depot files as the target, ///
at a different revision. ///
///
The 'p4 resolve' file argument specifies the target. If the file ///
argument is omitted, all unresolved files are resolved. ///
///
Resolving can modify workspace files. To back up files, use 'p4 ///
shelve' before using 'p4 resolve'. ///
///
The resolve process is a classic three-way merge. The participating ///
files are referred to as follows: ///
///
'yours' The target file open in the client workspace ///
'theirs' The source file in the depot ///
'base' The common ancestor; the highest revision of the ///
source file already accounted for in the target. ///
'merged' The merged result. ///
///
Filenames, filetypes, and text file content can be resolved by ///
accepting 'yours', 'theirs', or 'merged'. Branching, deletion, and ///
binary file content can be resolved by accepting either 'yours' or ///
'theirs'. ///
///
When resolving integrated changes, 'p4 resolve' distinguishes among ///
four results: entirely yours, entirely theirs, a pure merge, or an ///
edited merge. The distinction is recorded when resolved files are ///
submitted, and will be used by future commands to determine whether ///
integration is needed. ///
///
In all cases, accepting 'yours' leaves the target file in its current ///
state. The result of accepting 'theirs' is as follows: ///
///
Content: The target file content is overwritten. ///
Branching: A new target is branched. ///
Deletion: The target file is deleted. ///
Filename: The target file is moved or renamed. ///
Filetype: The target file's type is changed. ///
///
For each unresolved change, the user is prompted to accept a result. ///
Content and non-content changes are resolved separately. For content, ///
'p4 resolve' places the merged result into a temporary file in the ///
client workspace. If there are any conflicts, the merged file contains ///
conflict markers that must be removed by the user. ///
///
'p4 resolve' displays a count of text diffs and conflicts, and offers ///
the following prompts: ///
///
Accept: ///
at Keep only changes to their file. ///
ay Keep only changes to your file. ///
* am Keep merged file. ///
* ae Keep merged and edited file. ///
* a Keep autoselected file. ///
///
Diff: ///
* dt See their changes alone. ///
* dy See your changes alone. ///
* dm See merged changes. ///
d Diff your file against merged file. ///
///
Edit: ///
et Edit their file (read only). ///
ey Edit your file (read/write). ///
* e Edit merged file (read/write). ///
///
Misc: ///
* m Run '$P4MERGE base theirs yours merged'. ///
(Runs '$P4MERGEUNICODE charset base theirs ///
yours merged' if set and the file is a ///
unicode file.) ///
s Skip this file. ///
h Print this help message. ///
^C Quit the resolve operation. ///
///
Options marked (*) appear only for text files. The suggested action ///
will be displayed in brackets. ///
///
The 'merge' (m) option enables you to invoke your own merge program, if ///
one is configured using the $P4MERGE environment variable. Four files ///
are passed to the program: the base, yours, theirs, and the temporary ///
file. The program is expected to write merge results to the temporary ///
file. ///
///
The -A flag can be used to limit the kind of resolving that will be ///
attempted; without it, everything is attempted: ///
///
-Ab Resolve file branching. ///
-Ac Resolve file content changes. ///
-Ad Resolve file deletions. ///
-Am Resolve moved and renamed files. ///
-At Resolve filetype changes. ///
///
The -a flag puts 'p4 resolve' into automatic mode. The user is not ///
prompted, and files that can't be resolved automatically are skipped: ///
///
-as 'Safe' resolve; skip files that need merging. ///
-am Resolve by merging; skip files with conflicts. ///
-af Force acceptance of merged files with conflicts. ///
-at Force acceptance of theirs; overwrites yours. ///
-ay Force acceptance of yours; ignores theirs. ///
///
The -as flag causes the workspace file to be replaced with their file ///
only if theirs has changed and yours has not. ///
///
The -am flag causes the workspace file to be replaced with the result ///
of merging theirs with yours. If the merge detected conflicts, the ///
file is left untouched and uresolved. ///
///
The -af flag causes the workspace file to be replaced with the result ///
of merging theirs with yours, even if there were conflicts. This can ///
leave conflict markers in workspace files. ///
///
The -at flag resolves all files by copying theirs into yours. It ///
should be used with care, as it overwrites any changes made to the ///
file in the client workspace. ///
///
The -ay flag resolves all files by accepting yours and ignoring ///
theirs. It preserves the content of workspace files. ///
///
The -d flags can be used to control handling of whitespace and line ///
endings when merging files: ///
///
-db Ingore whitespace changes. ///
-dw Ingore whitespace altogether. ///
-dl Ignores line endings. ///
///
The -d flags are also passed to the diff options in the 'p4 resolve' ///
dialog. Additional -d flags that modify the diff output but do not ///
modify merge behavior include -dn (RCS), -dc (context), -ds (summary), ///
and -du (unified). Note that 'p4 resolve' uses text from the client ///
file if the files differ only in whitespace. ///
///
The -f flag enables previously resolved content to be resolved again. ///
By default, after files have been resolved, 'p4 resolve' does not ///
process them again. ///
///
The -n flag previews the operation without altering files. ///
///
The -N flag previews the operation with additional information about ///
any non-content resolve actions that are scheduled. ///
///
The -o flag displays the base file name and revision to be used ///
during the the merge. ///
///
The -t flag forces 'p4 resolve' to attempt a textual merge, even for ///
files with non-text (binary) types. ///
///
The -v flag causes 'p4 resolve' to insert markers for all changes, ///
not just conflicts. ///
///
The -c flag limits 'p4 resolve' to the files in changelist#. ///
///
///
/// Content: The target file content is overwritten. /// Branching: A new target is branched. /// Deletion: The target file is deleted. /// Filename: The target file is moved or renamed. /// Filetype: The target file's type is changed. /// /// For each unresolved change, the user is prompted to accept a result. /// Content and non-content changes are resolved separately. For content, /// 'p4 resolve' places the merged result into a temporary file in the /// client workspace. If there are any conflicts, the merged file contains /// conflict markers that must be removed by the user. /// /// 'p4 resolve' displays a count of text diffs and conflicts, and offers /// the following prompts: /// /// Accept: /// at Keep only changes to their file. /// ay Keep only changes to your file. /// * am Keep merged file. /// * ae Keep merged and edited file. /// * a Keep autoselected file. /// /// Diff: /// * dt See their changes alone. /// * dy See your changes alone. /// * dm See merged changes. /// d Diff your file against merged file. /// /// Edit: /// et Edit their file (read only). /// ey Edit your file (read/write). /// * e Edit merged file (read/write). /// /// Misc: /// * m Run '$P4MERGE base theirs yours merged'. /// (Runs '$P4MERGEUNICODE charset base theirs /// yours merged' if set and the file is a /// unicode file.) /// s Skip this file. /// h Print this help message. /// ^C Quit the resolve operation. /// Options marked (*) appear only for text files. The suggested action /// will be displayed in brackets. /// /// The 'merge' (m) option enables you to invoke your own merge program, if /// one is configured using the $P4MERGE environment variable. Four files /// are passed to the program: the base, yours, theirs, and the temporary /// file. The program is expected to write merge results to the temporary /// file. /// /// The -A flag can be used to limit the kind of resolving that will be /// attempted; without it, everything is attempted: /// /// -Ab Resolve file branching. /// -Ac Resolve file content changes. /// -Ad Resolve file deletions. /// -Am Resolve moved and renamed files. /// -At Resolve filetype changes. /// /// The -a flag puts 'p4 resolve' into automatic mode. The user is not /// prompted, and files that can't be resolved automatically are skipped: /// /// -as 'Safe' resolve; skip files that need merging. /// -am Resolve by merging; skip files with conflicts. /// -af Force acceptance of merged files with conflicts. /// -at Force acceptance of theirs; overwrites yours. /// -ay Force acceptance of yours; ignores theirs. /// /// The -as flag causes the workspace file to be replaced with their file /// only if theirs has changed and yours has not. /// /// The -am flag causes the workspace file to be replaced with the result /// of merging theirs with yours. If the merge detected conflicts, the /// file is left untouched and unresolved. /// /// The -af flag causes the workspace file to be replaced with the result /// of merging theirs with yours, even if there were conflicts. This can /// leave conflict markers in workspace files. /// /// The -at flag resolves all files by copying theirs into yours. It /// should be used with care, as it overwrites any changes made to the /// file in the client workspace. /// /// The -ay flag resolves all files by accepting yours and ignoring /// theirs. It preserves the content of workspace files. /// /// The -d flags can be used to control handling of whitespace and line /// endings when merging files: /// /// -db Ignore whitespace changes. /// -dw Ignore whitespace altogether. /// -dl Ignores line endings. /// /// The -d flags are also passed to the diff options in the 'p4 resolve' /// dialog. Additional -d flags that modify the diff output but do not /// modify merge behavior include -dn (RCS), -dc (context), -ds (summary), /// and -du (unified). Note that 'p4 resolve' uses text from the client /// file if the files differ only in whitespace. /// /// The -f flag enables previously resolved files to be resolved again. /// By default, after files have been resolved, 'p4 resolve' does not /// process them again. /// /// The -n flag previews the operation without altering files. /// /// The -N flag previews the operation with additional information about /// any non-content resolve actions that are scheduled. /// /// The -o flag displays the base file name and revision to be used /// during the the merge. /// /// The -t flag forces 'p4 resolve' to attempt a textual merge, even for /// files with non-text (binary) types. /// /// The -v flag causes 'p4 resolve' to insert markers for all changes, /// not just conflicts. /// /// The -c flag limits 'p4 resolve' to the files in changelist#. /// public IList ResolveFiles(Options options, params FileSpec[] files) { return ResolveFiles(null, options, files); } List CurrentResolveRecords = null; FileResolveRecord CurrentResolveRecord = null; public delegate P4.P4ClientMerge.MergeStatus AutoResolveDelegate(P4.P4ClientMerge.MergeForce mergeForce); public delegate P4.P4ClientMerge.MergeStatus ResolveFileDelegate(FileResolveRecord resolveRecord, AutoResolveDelegate AutoResolve, string sourcePath, string targetPath, string basePath, string resultsPath); private ResolveFileDelegate ResolveFileHandler = null; P4ClientMerge.MergeForce ForceMerge = P4ClientMerge.MergeForce.CMF_AUTO; private P4.P4ClientMerge.MergeStatus HandleResolveFile(uint cmdId, P4.P4ClientMerge cm) { if (CurrentResolveRecord.Analysis == null) { CurrentResolveRecord.Analysis = new ResolveAnalysis(); } // this is from a content resolve CurrentResolveRecord.Analysis.SetResolveType(ResolveType.Content); CurrentResolveRecord.Analysis.SourceDiffCnt = cm.GetYourChunks(); CurrentResolveRecord.Analysis.TargetDiffCnt = cm.GetTheirChunks(); CurrentResolveRecord.Analysis.CommonDiffCount = cm.GetBothChunks(); CurrentResolveRecord.Analysis.ConflictCount = cm.GetConflictChunks(); CurrentResolveRecord.Analysis.SuggestedAction = cm.AutoResolve(P4ClientMerge.MergeForce.CMF_AUTO); if ((ResolveFileHandler != null) && (CurrentResolveRecord != null)) { try { return ResolveFileHandler(CurrentResolveRecord, new AutoResolveDelegate(cm.AutoResolve), cm.GetTheirFile(), cm.GetYourFile(), cm.GetBaseFile(), cm.GetResultFile()); } catch (Exception ex) { LogFile.LogException("Error", ex); return P4ClientMerge.MergeStatus.CMS_SKIP; } } return P4ClientMerge.MergeStatus.CMS_SKIP; } private P4.P4ClientMerge.MergeStatus HandleResolveAFile(uint cmdId, P4.P4ClientResolve cr) { string strType = cr.ResolveType; if (strType.Contains("resolve")) { strType = strType.Replace("resolve", string.Empty).Trim(); if ((strType == "Rename") || (strType == "Filename")) { strType = "Move"; } } if (CurrentResolveRecord.Analysis == null) { CurrentResolveRecord.Analysis = new ResolveAnalysis(); } // this is likely from an action resolve CurrentResolveRecord.Analysis.SetResolveType(strType); CurrentResolveRecord.Analysis.Options = ResolveOptions.Skip; // can always skip if (string.IsNullOrEmpty(cr.MergeAction) == false) { CurrentResolveRecord.Analysis.Options |= ResolveOptions.Merge; CurrentResolveRecord.Analysis.MergeAction = cr.MergeAction; } if (string.IsNullOrEmpty(cr.TheirAction) == false) { CurrentResolveRecord.Analysis.Options |= ResolveOptions.AccecptTheirs; CurrentResolveRecord.Analysis.TheirsAction = cr.TheirAction; } if (string.IsNullOrEmpty(cr.YoursAction) == false) { CurrentResolveRecord.Analysis.Options |= ResolveOptions.AcceptYours; CurrentResolveRecord.Analysis.YoursAction = cr.YoursAction; } // this is likely from an action resolve CurrentResolveRecord.Analysis.SetResolveType(strType); CurrentResolveRecord.Analysis.SuggestedAction = cr.AutoResolve(P4ClientMerge.MergeForce.CMF_AUTO); if ((ResolveFileHandler != null) && (CurrentResolveRecord != null)) { try { return ResolveFileHandler(CurrentResolveRecord, new AutoResolveDelegate(cr.AutoResolve), null, null, null, null); } catch (Exception ex) { LogFile.LogException("Error", ex); return P4ClientMerge.MergeStatus.CMS_SKIP; } } return P4ClientMerge.MergeStatus.CMS_SKIP; } private P4.P4Server.TaggedOutputDelegate ResultsTaggedOutputHandler = null; private void ResultsTaggedOutputReceived(uint cmdId, int ObjId, TaggedObject Obj) { if (CurrentResolveRecord != null) { CurrentResolveRecords.Add(CurrentResolveRecord); CurrentResolveRecord = null; } //Create a record for this file resolve results CurrentResolveRecord = FileResolveRecord.FromResolveCmdTaggedOutput(Obj); } /// /// Resolve files /// /// /// /// /// /// /// The caller must either /// 1) set an automatic resolution (-as, -am.-af, -at, or -ay), /// 2) provide a callback function of type to /// respond to the prompts, or 3) provide a dictionary which contains responses to the prompts. ///
///
p4 help resolve ///
///
resolve -- Resolve integrations and updates to workspace files ///
///
p4 resolve [options] [file ...] ///
///
options: -A<flags> -a<flags> -d<flags> -f -n -N -o -t -v ///
-c changelist# ///
///
'p4 resolve' resolves changes to files in the client workspace. ///
///
'p4 resolve' works only on files that have been scheduled to be ///
resolved. The commands that can schedule resolves are: 'p4 sync', ///
'p4 update', 'p4 submit', 'p4 merge', and 'p4 integrate'. Files must ///
be resolved before they can be submitted. ///
///
Resolving involves two sets of files, a source and a target. The ///
target is a set of depot files that maps to opened files in the ///
client workspace. When resolving an integration, the source is a ///
different set of depot files than the target. When resolving an ///
update, the source is the same set of depot files as the target, ///
at a different revision. ///
///
The 'p4 resolve' file argument specifies the target. If the file ///
argument is omitted, all unresolved files are resolved. ///
///
Resolving can modify workspace files. To back up files, use 'p4 ///
shelve' before using 'p4 resolve'. ///
///
The resolve process is a classic three-way merge. The participating ///
files are referred to as follows: ///
///
'yours' The target file open in the client workspace ///
'theirs' The source file in the depot ///
'base' The common ancestor; the highest revision of the ///
source file already accounted for in the target. ///
'merged' The merged result. ///
///
Filenames, filetypes, and text file content can be resolved by ///
accepting 'yours', 'theirs', or 'merged'. Branching, deletion, and ///
binary file content can be resolved by accepting either 'yours' or ///
'theirs'. ///
///
When resolving integrated changes, 'p4 resolve' distinguishes among ///
four results: entirely yours, entirely theirs, a pure merge, or an ///
edited merge. The distinction is recorded when resolved files are ///
submitted, and will be used by future commands to determine whether ///
integration is needed. ///
///
In all cases, accepting 'yours' leaves the target file in its current ///
state. The result of accepting 'theirs' is as follows: ///
///
Content: The target file content is overwritten. ///
Branching: A new target is branched. ///
Deletion: The target file is deleted. ///
Filename: The target file is moved or renamed. ///
Filetype: The target file's type is changed. ///
///
For each unresolved change, the user is prompted to accept a result. ///
Content and non-content changes are resolved separately. For content, ///
'p4 resolve' places the merged result into a temporary file in the ///
client workspace. If there are any conflicts, the merged file contains ///
conflict markers that must be removed by the user. ///
///
'p4 resolve' displays a count of text diffs and conflicts, and offers ///
the following prompts: ///
///
Accept: ///
at Keep only changes to their file. ///
ay Keep only changes to your file. ///
* am Keep merged file. ///
* ae Keep merged and edited file. ///
* a Keep autoselected file. ///
///
Diff: ///
* dt See their changes alone. ///
* dy See your changes alone. ///
* dm See merged changes. ///
d Diff your file against merged file. ///
///
Edit: ///
et Edit their file (read only). ///
ey Edit your file (read/write). ///
* e Edit merged file (read/write). ///
///
Misc: ///
* m Run '$P4MERGE base theirs yours merged'. ///
(Runs '$P4MERGEUNICODE charset base theirs ///
yours merged' if set and the file is a ///
unicode file.) ///
s Skip this file. ///
h Print this help message. ///
^C Quit the resolve operation. ///
///
Options marked (*) appear only for text files. The suggested action ///
will be displayed in brackets. ///
///
The 'merge' (m) option enables you to invoke your own merge program, if ///
one is configured using the $P4MERGE environment variable. Four files ///
are passed to the program: the base, yours, theirs, and the temporary ///
file. The program is expected to write merge results to the temporary ///
file. ///
///
The -A flag can be used to limit the kind of resolving that will be ///
attempted; without it, everything is attempted: ///
///
-Ab Resolve file branching. ///
-Ac Resolve file content changes. ///
-Ad Resolve file deletions. ///
-Am Resolve moved and renamed files. ///
-At Resolve filetype changes. ///
///
The -a flag puts 'p4 resolve' into automatic mode. The user is not ///
prompted, and files that can't be resolved automatically are skipped: ///
///
-as 'Safe' resolve; skip files that need merging. ///
-am Resolve by merging; skip files with conflicts. ///
-af Force acceptance of merged files with conflicts. ///
-at Force acceptance of theirs; overwrites yours. ///
-ay Force acceptance of yours; ignores theirs. ///
///
The -as flag causes the workspace file to be replaced with their file ///
only if theirs has changed and yours has not. ///
///
The -am flag causes the workspace file to be replaced with the result ///
of merging theirs with yours. If the merge detected conflicts, the ///
file is left untouched and uresolved. ///
///
The -af flag causes the workspace file to be replaced with the result ///
of merging theirs with yours, even if there were conflicts. This can ///
leave conflict markers in workspace files. ///
///
The -at flag resolves all files by copying theirs into yours. It ///
should be used with care, as it overwrites any changes made to the ///
file in the client workspace. ///
///
The -ay flag resolves all files by accepting yours and ignoring ///
theirs. It preserves the content of workspace files. ///
///
The -d flags can be used to control handling of whitespace and line ///
endings when merging files: ///
///
-db Ingore whitespace changes. ///
-dw Ingore whitespace altogether. ///
-dl Ignores line endings. ///
///
The -d flags are also passed to the diff options in the 'p4 resolve' ///
dialog. Additional -d flags that modify the diff output but do not ///
modify merge behavior include -dn (RCS), -dc (context), -ds (summary), ///
and -du (unified). Note that 'p4 resolve' uses text from the client ///
file if the files differ only in whitespace. ///
///
The -f flag enables previously resolved content to be resolved again. ///
By default, after files have been resolved, 'p4 resolve' does not ///
process them again. ///
///
The -n flag previews the operation without altering files. ///
///
The -N flag previews the operation with additional information about ///
any non-content resolve actions that are scheduled. ///
///
The -o flag displays the base file name and revision to be used ///
during the the merge. ///
///
The -t flag forces 'p4 resolve' to attempt a textual merge, even for ///
files with non-text (binary) types. ///
///
The -v flag causes 'p4 resolve' to insert markers for all changes, ///
not just conflicts. ///
///
The -c flag limits 'p4 resolve' to the files in changelist#. ///
///
///
public IList ResolveFiles( ResolveFileDelegate resolveHandler, Options options, params FileSpec[] files) { string change=null; options.TryGetValue("-c",out change); GetOpenedFilesOptions openedOptions = new GetOpenedFilesOptions((GetOpenedFilesCmdFlags.None), change,null,null,-1); CurrentResolveRecords = new List(); try { string[] paths = null; try { IList clientFiles = runFileListCmd("opened", openedOptions, files); paths = FileSpec.ToEscapedPaths(clientFiles.ToArray()); } catch { paths = FileSpec.ToEscapedPaths(files); } ResultsTaggedOutputHandler = new P4Server.TaggedOutputDelegate(ResultsTaggedOutputReceived); Connection._p4server.TaggedOutputReceived += ResultsTaggedOutputHandler; ResolveFileHandler = resolveHandler; foreach (string path in paths) { P4Command cmd = new P4Command(Connection, "resolve", true, path); cmd.CmdResolveHandler = new P4Server.ResolveHandlerDelegate(HandleResolveFile); cmd.CmdResolveAHandler = new P4Server.ResolveAHandlerDelegate(HandleResolveAFile); CurrentResolveRecord = null; P4CommandResult results = cmd.Run(options); if (results.Success) { if (CurrentResolveRecord != null) { CurrentResolveRecords.Add(CurrentResolveRecord); CurrentResolveRecord = null; } else { if (results.ErrorList[0].ErrorMessage.Contains("no file(s) to resolve")) { continue; } // not in interactive mode FileResolveRecord record = null; if ((results.TaggedOutput != null) && (results.TaggedOutput.Count > 0)) { foreach (TaggedObject obj in results.TaggedOutput) { record = new FileResolveRecord(obj); if (record != null) { CurrentResolveRecords.Add(record); } } } } } else { P4Exception.Throw(results.ErrorList); } } if (CurrentResolveRecords.Count > 0) { return CurrentResolveRecords; } return null; } finally { if (ResultsTaggedOutputHandler != null) { Connection._p4server.TaggedOutputReceived -= ResultsTaggedOutputHandler; } } } [Obsolete("This version of resolve is superseded ")] internal List ResolveFiles(P4Server.ResolveHandlerDelegate resolveHandler, P4Server.PromptHandlerDelegate promptHandler, Dictionary promptResponses, Options options, params FileSpec[] files) { string[] paths = FileSpec.ToEscapedPaths(files); P4Command cmd = new P4Command(Connection, "resolve", true, paths); if (resolveHandler != null) { cmd.CmdResolveHandler = resolveHandler; } else if (promptHandler != null) { cmd.CmdPromptHandler = promptHandler; } else if (promptResponses != null) { cmd.Responses = promptResponses; } P4CommandResult results = cmd.Run(options); if (results.Success) { Dictionary recordMap = new Dictionary(); List records = new List(); if ((results.TaggedOutput != null) && (results.TaggedOutput.Count > 0)) { foreach (TaggedObject obj in results.TaggedOutput) { FileResolveRecord record1 = FileResolveRecord.FromResolveCmdTaggedOutput(obj); records.Add(record1); if (record1.LocalFilePath != null) { recordMap[record1.LocalFilePath.Path.ToLower()] = record1; } } } if ((results.InfoOutput != null) && (results.InfoOutput.Count > 0)) { string l1 = null; string l2 = null; string l3 = null; FileResolveRecord record2 = null; int RecordsPerItem = results.InfoOutput.Count / files.Length; for (int idx = 0; idx < results.InfoOutput.Count; idx += RecordsPerItem) { l1 = results.InfoOutput[idx].Message; if (RecordsPerItem == 3) { l2 = results.InfoOutput[idx + 1].Message; l3 = results.InfoOutput[idx + 2].Message; } if (RecordsPerItem == 2) { l2 = null; l3 = results.InfoOutput[idx + 1].Message; } record2 = FileResolveRecord.FromMergeInfo(l1, l2, l3); if ((record2 != null) && (recordMap.ContainsKey(record2.LocalFilePath.Path.ToLower()))) { FileResolveRecord record1 = recordMap[record2.LocalFilePath.Path.ToLower()]; FileResolveRecord.MergeRecords(record1, record2); } else { records.Add(record2); } } } return records; } else { P4Exception.Throw(results.ErrorList); } return null; } public IList ResolveFiles(IList files, Options options) { return ResolveFiles(options, files.ToArray()); } /// /// /// /// /// /// /// ///
p4 help submit ///
///
submit -- Submit open files to the depot ///
///
p4 submit [-r -s -f option] ///
p4 submit [-r -s -f option] file ///
p4 submit [-r -f option] -d description ///
p4 submit [-r -f option] -d description file ///
p4 submit [-r -f option] -c changelist# ///
p4 submit -i [-r -s -f option] ///
///
'p4 submit' commits a pending changelist and its files to the depot. ///
///
By default, 'p4 submit' attempts to submit all files in the 'default' ///
changelist. Submit displays a dialog where you enter a description ///
of the change and, optionally, delete files from the list of files ///
to be checked in. ///
///
To add files to a changelist before submitting, use any of the ///
commands that open client workspace files: 'p4 add', 'p4 edit', ///
etc. ///
///
If the file parameter is specified, only files in the default ///
changelist that match the pattern are submitted. ///
///
Files in a stream path can be submitted only by client workspaces ///
dedicated to the stream. See 'p4 help client'. ///
///
Before committing a changelist, 'p4 submit' locks all the files being ///
submitted. If any file cannot be locked or submitted, the files are ///
left open in a numbered pending changelist. 'p4 opened' shows ///
unsubmitted files and their changelists. ///
///
Submit is atomic: if the operation succeeds, all files are updated ///
in the depot. If the submit fails, no depot files are updated. ///
///
The -c flag submits the specified pending changelist instead of the ///
default changelist. Additional changelists can be created manually, ///
using the 'p4 change' command, or automatically as the result of a ///
failed attempt to submit the default changelist. ///
///
The -d flag passes a description into the specified changelist rather ///
than displaying the changelist dialog for manual editing. This option ///
is useful for scripting, but does not allow you to add jobs or modify ///
the default changelist. ///
///
The -f flag enables you to override submit options that are configured ///
for the client that is submitting the changelist. This flag overrides ///
the -r (reopen)flag, if it is specified. See 'p4 help client' for ///
details about submit options. ///
///
The -i flag reads a changelist specification from the standard input. ///
The user's editor is not invoked. ///
///
The -r flag reopens submitted files in the default changelist after ///
submission. ///
///
The -s flag extends the list of jobs to include the fix status ///
for each job, which becomes the job's status when the changelist ///
is committed. See 'p4 help change' for details. ///
///
///
public SubmitResults SubmitFiles(Options options, FileSpec file) { P4Command cmd = null; if (file != null) { cmd = new P4Command(Connection, "submit", true, file.ToEscapedString()); } else { cmd = new P4Command(Connection, "submit", true); } if (options != null&&!options.ContainsKey("-e")) { //the new Changelist Spec is passed using the command dataset if (options.ContainsKey("-i")) { cmd.DataSet = options["-i"]; options["-i"] = null; } } P4CommandResult results = cmd.Run(options); if (results.Success) { if ((results.TaggedOutput == null) || (results.TaggedOutput.Count <= 0)) { return null; } SubmitResults returnVal = new SubmitResults(); foreach (TaggedObject obj in results.TaggedOutput) { if (obj.ContainsKey("submittedChange")) { int i = -1; // the changelist number after the submit if (int.TryParse(obj["submittedChange"], out i)) returnVal.ChangeIdAfterSubmit = i; } else if (obj.ContainsKey("change")) { // The changelist use by the submit int i = -1; if (int.TryParse(obj["change"], out i)) returnVal.ChangeIdBeforeSubmit = i; if (obj.ContainsKey("locked")) { if (int.TryParse(obj["locked"], out i)) { returnVal.FilesLockedBySubmit = i; } } } else { // a file in the submit StringEnum action = null; if (obj.ContainsKey("action")) { action = obj["action"]; } FileSpec spec = null; int rev = -1; string p; DepotPath dp = null; ClientPath cp = null; LocalPath lp = null; if (obj.ContainsKey("rev")) { int.TryParse(obj["rev"], out rev); } if (obj.ContainsKey("depotFile")) { p = obj["depotFile"]; dp = new DepotPath(p); } if (obj.ContainsKey("clientFile")) { p = obj["clientFile"]; if (p.StartsWith("//")) { cp = new ClientPath(p); } else { cp = new ClientPath(p); lp = new LocalPath(p); } } if (obj.ContainsKey("path")) { lp = new LocalPath(obj["path"]); } FileSpec fs = new FileSpec(dp, cp, lp, new Revision(rev)); returnVal.Files.Add(new FileSubmitRecord(action, fs)); } } return returnVal; } else { P4Exception.Throw(results.ErrorList); } return null; } /// /// /// /// /// /// /// ///
p4 help resolved ///
///
resolved -- Show files that have been resolved but not submitted ///
///
p4 resolved [-o] [file ...] ///
///
'p4 resolved' lists file updates and integrations that have been ///
resolved but not yet submitted. To see unresolved integrations, ///
use 'p4 resolve -n'. To see already submitted integrations, use ///
'p4 integrated'. ///
///
If a depot file path is specified, the output lists resolves for ///
'theirs' files that match the specified path. If a client file ///
path is specified, the output lists resolves for 'yours' files ///
that match the specified path. ///
///
The -o flag reports the revision used as the base during the ///
resolve. ///
///
///
public IList GetResolvedFiles(Options options, params FileSpec[] files) { P4Command cmd = new P4Command(Connection, "resolved", true, FileSpec.ToStrings(files)); P4CommandResult results = cmd.Run(options); if (results.Success) { if ((results.TaggedOutput == null) || (results.TaggedOutput.Count <= 0)) { return null; } List fileList = new List(); foreach (TaggedObject obj in results.TaggedOutput) { fileList.Add(FileResolveRecord.FromResolvedCmdTaggedOutput(obj)); } return fileList; } else { P4Exception.Throw(results.ErrorList); } return null; } /// /// /// /// /// /// public IList GetResolvedFiles(IList Files, Options options) { return GetResolvedFiles(options, Files.ToArray()); } /// /// /// /// RevertFilesOptions /// /// /// ///
p4 help revert ///
///
revert -- Discard changes from an opened file ///
///
p4 revert [-a -n -k -c changelist#] file ... ///
///
Revert an open file to the revision that was synced from the depot, ///
discarding any edits or integrations that have been made. You must ///
explicitly specify the files to be reverted. Files are removed from ///
the changelist in which they are open. Locked files are unlocked. ///
///
The -a flag reverts only files that are open for edit or integrate ///
and are unchanged or missing. Files with pending integration records ///
are left open. The file arguments are optional when -a is specified. ///
///
The -n flag displays a preview of the operation. ///
///
The -k flag marks the file as reverted in server metadata without ///
altering files in the client workspace. ///
///
The -c flag reverts files that are open in the specified changelist. ///
///
///
public IList RevertFiles(Options options, params FileSpec[] files) { return runFileListCmd("revert", options, files); } /// /// /// /// /// /// public IList RevertFiles(IList Files, Options options) { return RevertFiles(options, Files.ToArray()); } /// /// /// /// /// /// /// ///
p4 help shelve ///
///
shelve -- Store files from a pending changelist into the depot ///
///
p4 shelve [files] ///
p4 shelve -i [-f | -r] ///
p4 shelve -r -c changelist# ///
p4 shelve -c changelist# [-f] [file ...] ///
p4 shelve -d -c changelist# [-f] [file ...] ///
///
'p4 shelve' creates, modifies or deletes shelved files in a pending ///
changelist. Shelved files remain in the depot until they are deleted ///
(using 'p4 shelve -d') or replaced by subsequent shelve commands. ///
After 'p4 shelve', the user can revert the files and restore them ///
later using 'p4 unshelve'. Other users can 'p4 unshelve' the stored ///
files into their own workspaces. ///
///
Files that have been shelved can be accessed by the 'p4 diff', ///
'p4 diff2', 'p4 files' and 'p4 print' commands using the revision ///
specification '@=change', where 'change' is the pending changelist ///
number. ///
///
By default, 'p4 shelve' creates a changelist, adds files from the ///
user's default changelist, then shelves those files in the depot. ///
The user is presented with a text changelist form displayed using ///
the editor configured using the $P4EDITOR environment variable. ///
///
If a file pattern is specified, 'p4 shelve' shelves the files that ///
match the pattern. ///
///
The -i flag reads the pending changelist specification with shelved ///
files from the standard input. The user's editor is not invoked. ///
To modify an existing changelist with shelved files, specify the ///
changelist number using the -c flag. ///
///
The -c flag specifies the pending changelist that contains shelved ///
files to be created, deleted, or modified. Only the user and client ///
of the pending changelist can add or modify its shelved files. ///
///
The -f (force) flag must be used with the -c or -i flag to overwrite ///
any existing shelved files in a pending changelist. ///
///
The -r flag (used with -c or -i) enables you to replace all shelved ///
files in that changelist with the files opened in your own workspace ///
at that changelist number. Only the user and client workspace of the ///
pending changelist can replace its shelved files. ///
///
The -d flag (used with -c) deletes the shelved files in the specified ///
changelist so that they can no longer be unshelved. By default, only ///
the user and client of the pending changelist can delete its shelved ///
files. A user with 'admin' access can delete shelved files by including ///
the -f flag to force the operation. ///
///
///
public IList ShelveFiles(Options options, params FileSpec[] files) { string cmdData = null; if (options.ContainsKey("-i")) { cmdData = options["-i"]; options["-i"] = null; } return runFileListCmd("shelve", options, cmdData, files); } /// /// /// /// /// /// public IList ShelveFiles(IList Files, Options options) { return ShelveFiles(options, Files!=null?Files.ToArray(): null ); } /// /// /// /// /// /// /// ///
p4 help sync ///
///
sync -- Synchronize the client with its view of the depot ///
flush -- synonym for 'sync -k' ///
update -- synonym for 'sync -s' ///
///
p4 sync [-f -L -n -k -q] [-m max] [file[revRange] ...] ///
p4 sync [-L -n -q -s] [-m max] [file[revRange] ...] ///
p4 sync [-L -n -p -q] [-m max] [file[revRange] ...] ///
///
Sync updates the client workspace to reflect its current view (if ///
it has changed) and the current contents of the depot (if it has ///
changed). The client view maps client and depot file names and ///
locations. ///
///
Sync adds files that are in the client view and have not been ///
retrieved before. Sync deletes previously retrieved files that ///
are no longer in the client view or have been deleted from the ///
depot. Sync updates files that are still in the client view and ///
have been updated in the depot. ///
///
By default, sync affects all files in the client workspace. If file ///
arguments are given, sync limits its operation to those files. ///
The file arguments can contain wildcards. ///
///
If the file argument includes a revision specifier, then the given ///
revision is retrieved. Normally, the head revision is retrieved. ///
See 'p4 help revisions' for help specifying revisions. ///
///
If the file argument includes a revision range specification, ///
only files selected by the revision range are updated, and the ///
highest revision in the range is used. ///
///
Normally, sync does not overwrite workspace files that the user has ///
manually made writable. Setting the 'clobber' option in the ///
client specification disables this safety check. ///
///
The -f flag forces resynchronization even if the client already ///
has the file, and overwriting any writable files. This flag doesn't ///
affect open files. ///
///
The -L flag can be used with multiple file arguments that are in ///
full depot syntax and include a valid revision number. When this ///
flag is used the arguments are processed together by building an ///
internal table similar to a label. This file list processing is ///
significantly faster than having to call the internal query engine ///
for each individual file argument. However, the file argument syntax ///
is strict and the command will not run if an error is encountered. ///
///
The -n flag previews the operation without updating the workspace. ///
///
The -k flag updates server metadata without syncing files. It is ///
intended to enable you to ensure that the server correctly reflects ///
the state of files in the workspace while avoiding a large data ///
transfer. Caution: an erroneous update can cause the server to ///
incorrectly reflect the state of the workspace. ///
///
The -p flag populates the client workspace, but does not update the ///
server to reflect those updates. Any file that is already synced or ///
opened will be bypassed with a warning message. This option is very ///
useful for build clients or when publishing content without the ///
need to track the state of the client workspace. ///
///
The -q flag suppresses normal output messages. Messages regarding ///
errors or exceptional conditions are not suppressed. ///
///
The -s flag adds a safety check before sending content to the client ///
workspace. This check uses MD5 digests to compare the content on the ///
clients workspace against content that was last synced. If the file ///
has been modified outside of Perforce's control then an error message ///
is displayed and the file is not overwritten. This check adds some ///
extra processing which will affect the performance of the operation. ///
///
The -m flag limits sync to the first 'max' number of files. This ///
option is useful in conjunction with tagged output and the '-n' ///
flag, to preview how many files will be synced without transferring ///
all the file data. ///
///
///
public IList SyncFiles(Options options, params FileSpec[] files) { return runFileListCmd("sync", options, files); } /// /// /// /// /// /// public IList SyncFiles(IList Files, Options options) { return SyncFiles(options, Files.ToArray()); } /// /// /// /// /// /// /// ///
p4 help unlock ///
///
unlock -- Release a locked file, leaving it open ///
///
p4 unlock [-c changelist#] [-f] [file ...] ///
///
'p4 unlock' releases locks on the specified files, which must be ///
open in the specified pending changelist. If you omit the changelist ///
number, the default changelist is assumed. If you omit the file name, ///
all locked files are unlocked. ///
///
By default, files can be unlocked only by the changelist owner. The ///
-f flag enables you to unlock files in changelists owned by other ///
users. The -f flag requires 'admin' access, which is granted by 'p4 ///
protect'. ///
///
///
public IList UnlockFiles(Options options, params FileSpec[] files) { return runFileListCmd("unlock", options, files); } /// /// /// /// /// /// public IList UnlockFiles(IList Files, Options options) { return UnlockFiles(options, Files.ToArray()); } /// /// /// /// /// /// /// ///
p4 help unshelve ///
///
unshelve -- Restore shelved files from a pending change into a workspace ///
///
p4 unshelve -s changelist# [-f -n] [-c changelist#] [file ...] ///
///
'p4 unshelve' retrieves shelved files from the specified pending ///
changelist, opens them in a pending changelist and copies them ///
to the invoking user's workspace. Unshelving files from a pending ///
changelist is restricted by the user's permissions on the files. ///
A successful unshelve operation places the shelved files on the ///
user's workspace with the same open action and pending integration ///
history as if it had originated from that user and client. ///
///
Unshelving a file over an already opened file is only permitted ///
if both shelved file and opened file are opened for 'edit'. After ///
unshelving, the workspace file is flagged as unresolved, and ///
'p4 resolve' must be run to resolve the differences between the ///
shelved file and the workspace file. ///
///
The -s flag specifies the number of the pending changelist that ///
contains the shelved files. ///
///
If a file pattern is specified, 'p4 unshelve' unshelves files that ///
match the pattern. ///
///
The -c flag specifies the changelist to which files are unshelved. ///
By default, 'p4 unshelve' opens shelved files in the default ///
changelist. ///
///
The -f flag forces the clobbering of any writeable but unopened files ///
that are being unshelved. ///
///
The -n flag previews the operation without changing any files or ///
metadata. ///
///
///
public IList UnshelveFiles(Options options, params FileSpec[] files) { return runFileListCmd("unshelve", options, files); } /// /// /// /// /// /// public IList UnshelveFiles(IList Files, Options options) { return UnshelveFiles(options, Files.ToArray()); } /// /// /// /// /// /// /// ///
p4 help where ///
///
where -- Show how file names are mapped by the client view ///
///
p4 where [file ...] ///
///
Where shows how the specified files are mapped by the client view. ///
For each argument, three names are produced: the name in the depot, ///
the name on the client in Perforce syntax, and the name on the client ///
in local syntax. ///
///
If the file parameter is omitted, the mapping for all files in the ///
current directory and below) is returned. ///
///
Note that 'p4 where' does not determine where any real files reside. ///
It only displays the locations that are mapped by the client view. ///
///
///
public IList GetClientFileMappings(params FileSpec[] files) { return runFileListCmd("where", null, files); } /// /// /// /// /// public IList GetClientFileMappings(IList Files) { return GetClientFileMappings(Files.ToArray()); } /// /// /// /// /// /// /// ///
p4 help copy ///
///
copy -- Copy one set of files to another ///
///
p4 copy [options] fromFile[rev] toFile ///
p4 copy [options] -b branch [-r] [toFile[rev] ...] ///
p4 copy [options] -b branch -s fromFile[rev] [toFile ...] ///
p4 copy [options] -S stream [-P parent] [-F] [-r] [toFile[rev] ...] ///
///
options: -c changelist# -n -v -m max ///
///
'p4 copy' copies one set of files (the 'source') into another (the ///
'target'). ///
///
Using the client workspace as a staging area, 'p4 copy' makes the ///
target identical to the source by branching, replacing, or deleting ///
files. 'p4 submit' submits copied files to the depot. 'p4 revert' ///
can be used to revert copied files instead of submitting them. The ///
history of copied files can be shown with 'p4 filelog' or 'p4 ///
integrated'. ///
///
Target files that are already identical to the source, or that are ///
outside of the client view, are not affected by 'p4 copy'. Opened, ///
non-identical target files cause 'p4 copy' to exit with a warning. ///
When 'p4 copy' creates or modifies files in the workspace, it leaves ///
them read-only; 'p4 edit' can make them writable. Files opened by ///
'p4 copy' do not need to be resolved. ///
///
Source and target files (fromFile and toFile) can be specified on ///
the 'p4 copy' command line or through a branch view. On the command ///
line, fromFile is the source file set and toFile is the target file ///
set. With a branch view, one or more toFile arguments can be given ///
to limit the scope of the target file set. ///
///
A revision specifier can be used to select the revision to copy; by ///
default, the head revision is copied. The revision specifier can be ///
used on fromFile, or on toFile, but not on both. When used on toFile, ///
it refers to source revisions, not to target revisions. A range may ///
not be used as a revision specifier. For revision syntax, see 'p4 ///
help revisions'. ///
///
The -S flag makes 'p4 copy' use a stream's branch view. (See 'p4 help ///
stream'.) The source is the stream itself, and the target is the ///
stream's parent. With -r, the direction is reversed. -P can be used ///
to specify a parent stream other than the stream's actual parent. ///
Note that to submit copied stream files, the current client must ///
be dedicated to the target stream. (See 'p4 help client'.) ///
///
The -F flag can be used with -S to force copying even though the ///
stream does not expect a copy to occur in the direction indicated. ///
Normally 'p4 copy' enforces the expected flow of change dictated ///
by the stream's spec. The 'p4 istat' command summarizes a stream's ///
expected flow of change. ///
///
The -b flag makes 'p4 copy' use a user-defined branch view. (See ///
'p4 help branch'.) The source is the left side of the branch view ///
and the target is the right side. With -r, the direction is reversed. ///
///
The -s flag can be used with -b to cause fromFile to be treated as ///
the source, and both sides of the user-defined branch view to be ///
treated as the target, per the branch view mapping. Optional toFile ///
arguments may be given to further restrict the scope of the target ///
file set. -r is ignored when -s is used. ///
///
The -c changelist# flag opens files in the designated (numbered) ///
pending changelist instead of the default changelist. ///
///
The -n flag displays a preview of the copy, without actually doing ///
anything. ///
///
The -m flag limits the actions to the first 'max' number of files. ///
///
The -v flag causes a 'virtual' copy that does not modify client ///
workspace files. After submitting a virtual integration, 'p4 sync' ///
can be used to update the workspace. ///
///
///
public IList CopyFiles(Options options, FileSpec fromFile, params FileSpec[] toFiles) { if ((options != null) && (options.ContainsKey("-s")) && (fromFile == null)) { throw new ArgumentNullException("fromFile", "From file cannot be null when the -s flag is specified"); } IList Files = null; if ((toFiles != null) && (toFiles.Length > 0)) { Files = new List(toFiles); } else { if (fromFile != null) { Files = new List(); } } if ((Files != null) && (fromFile != null)) { Files.Insert(0, fromFile); } return runFileListCmd("copy", options, Files.ToArray()); } public IList CopyFiles(FileSpec fromFile, IList toFiles, Options options) { return CopyFiles(options, fromFile, toFiles.ToArray()); } public IList CopyFiles(Options options) { return runFileListCmd("copy", options); } ///
p4 help merge ///
///
merge -- Merge one set of files into another ///
///
p4 merge [options] fromFile[revRange] toFile ///
p4 merge [options] -b branch [-r] [toFile[revRange] ...] ///
p4 merge [options] -b branch -s fromFile[revRange] [toFile ...] ///
p4 merge [options] -S stream [-P parent] [-F] [-r] [toFile[revRange] ...] ///
///
options: -c changelist# -n -m max ///
///
'p4 merge' merges changes from one set of files (the 'source') into ///
another (the 'target'). It is a simplified form of the 'p4 integrate' ///
command. ///
///
Using the client workspace as a staging area, 'p4 merge' branches and ///
deletes target files per changes in the source, and schedules all ///
other affected target files to be resolved. Target files outside of ///
the current client view are not affected. Source files need not be ///
within the client view. ///
///
'p4 resolve' must be used to merge file content, and to resolve ///
filename and filetype changes. 'p4 submit' commits merged files to ///
the depot. Unresolved files may not be submitted. Merged files can ///
be shelved with 'p4 shelve' and abandoned with 'p4 revert'. The ///
commands 'p4 integrated' and 'p4 filelog' display merge history. ///
///
When 'p4 merge' schedules a workspace file to be resolved, it leaves ///
it read-only. 'p4 resolve' can operate on a read-only file; for ///
other pre-submit changes, 'p4 edit' must be used to make the file ///
writable. ///
///
Source and target files can be specified either on the 'p4 merge' ///
command line or through a branch view. On the command line, fromFile ///
is the source file set and toFile is the target file set. With a ///
branch view, one or more toFile arguments can be given to limit the ///
scope of the target file set. ///
///
Each file in the target is mapped to a file in the source. Mapping ///
adjusts automatically for files that have been moved or renamed, as ///
long as 'p4 move' was used to move/rename files. The scope of source ///
and target file sets must include both old-named and new-named files ///
for mappings to be adjusted. Moved source files may schedule moves ///
to be resolved in target files. ///
///
revRange is a revision or a revision range that limits the span of ///
source history to be probed for unintegrated revisions. revRange ///
can be used on fromFile, or on toFile, but not on both. When used ///
on toFile, it refers to source revisions, not to target revisions. ///
For details about revision specifiers, see 'p4 help revisions'. ///
///
The -S flag makes 'p4 merge' use a stream's branch view. (See 'p4 ///
help stream'.) The source is the stream itself, and the target is ///
the stream's parent. With -r, the direction is reversed. -P can be ///
used to specify a parent stream other than the stream's actual parent. ///
Note that to submit merged stream files, the current client must ///
be dedicated to the target stream. (See 'p4 help client'.) ///
///
The -F flag can be used with -S to force merging even though the ///
stream does not expect a merge to occur in the direction indicated. ///
Normally 'p4 merge' enforces the expected flow of change dictated ///
by the stream's spec. The 'p4 istat' command summarizes a stream's ///
expected flow of change. ///
///
The -b flag makes 'p4 merge' use a user-defined branch view. (See ///
'p4 help branch'.) The source is the left side of the branch view ///
and the target is the right side. With -r, the direction is reversed. ///
///
The -s flag can be used with -b to cause fromFile to be treated as ///
the source, and both sides of the branch view to be treated as the ///
target, per the branch view mapping. Optional toFile arguments may ///
be given to further restrict the scope of the target file set. The ///
-r flag is ignored when -s is used. ///
///
public IList MergeFiles(Options options, FileSpec fromFile, params FileSpec[] toFiles) { if ((options != null) && (options.ContainsKey("-s")) && (fromFile == null)) { throw new ArgumentNullException("fromFile", "From file cannot be null when the -s flag is specified"); } IList Files = null; if ((toFiles != null) && (toFiles.Length > 0)) { Files = new List(toFiles); } else { if (fromFile != null) { Files = new List(); } } if ((Files != null) && (fromFile != null)) { Files.Insert(0, fromFile); } return runFileListCmd("merge", options, Files.ToArray()); } public IList MergeFiles(FileSpec fromFile, IList toFiles, Options options) { return MergeFiles(options, fromFile, toFiles.ToArray()); } public IList MergeFiles(Options options) { return runFileListCmd("merge", options); } #endregion } }