/// <summary> /// Create a copy of a filespec without a version /// </summary> public FileSpec StripVersion() { FileSpec fs = new FileSpec(this); fs.Version = null; return(fs); }
/// <summary> /// Read the fields from the tagged output of a diff2 command /// </summary> /// <param name="objectInfo">Tagged output from the 'diff2' command</param> /// <param name="connection"></param> /// <param name="options"></param> public void FromGetDepotFileDiffsCmdTaggedOutput(TaggedObject objectInfo, Connection connection, Options options) { DepotFileDiff ParsedDepotFileDiff = new DepotFileDiff(); string ldepotfile = string.Empty; string rdepotfile = string.Empty; int lrev = -1; int rrev = -1; if (objectInfo.ContainsKey("status")) { _type = objectInfo["status"]; } if (objectInfo.ContainsKey("depotFile")) { ldepotfile = objectInfo["depotFile"]; } if (objectInfo.ContainsKey("rev")) { int.TryParse(objectInfo["rev"], out lrev); } if (objectInfo.ContainsKey("depotFile2")) { rdepotfile = objectInfo["depotFile2"]; } if (objectInfo.ContainsKey("rev2")) { int.TryParse(objectInfo["rev2"], out rrev); } LeftFile = new FileSpec(new DepotPath(ldepotfile), new Revision(lrev)); RightFile = new FileSpec(new DepotPath(rdepotfile), new Revision(rrev)); if (objectInfo["status"] == "content") { string filepathl = ldepotfile + "#" + lrev; string filepathr = rdepotfile + "#" + rrev; P4.P4Command getDiffData = new P4Command(connection, "diff2", false, filepathl, filepathr); P4.P4CommandResult r = getDiffData.Run(options); if (r.Success != true) { P4Exception.Throw(r.ErrorList); } if (r.TextOutput != null) { Diff = r.TextOutput.ToString(); } else if (r.InfoOutput != null) { Diff = r.InfoOutput.ToString(); } } ParsedDepotFileDiff = new DepotFileDiff(Type, LeftFile, RightFile, Diff); }
public FileLineMatch(MatchType type, string line, int linenumber, FileSpec filespec) { Type = type; Line = line; LineNumber = linenumber; FileSpec = filespec; }
public void ParseGrepCmdTaggedData(TaggedObject obj) { if (obj.ContainsKey("depotFile")) { int rev = -1; if (obj.ContainsKey("rev")) { int.TryParse(obj["rev"], out rev); FileSpec = new FileSpec(new DepotPath(obj["depotFile"]), new Revision(rev)); } } Type = MatchType.Match; if (obj.ContainsKey("type")) { StringEnum <MatchType> matchtype = obj["type"]; Type = matchtype; } if (obj.ContainsKey("matchedLine")) { Line = obj["matchedLine"]; } if (obj.ContainsKey("line")) { int v = -1; int.TryParse(obj["line"], out v); LineNumber = v; } }
/// <summary> /// Copy Constructor /// </summary> /// <param name="fs">FileSpec</param> public FileSpec(FileSpec fs) { DepotPath = fs.DepotPath; ClientPath = fs.ClientPath; LocalPath = fs.LocalPath; Version = fs.Version; }
/// <summary> /// Create an array of FileSpec objects from a list of local paths /// </summary> /// <param name="paths">List of paths</param> /// <returns>List of FileSpec objects</returns> public static FileSpec[] LocalSpecArray(params String[] paths) { FileSpec[] val = new FileSpec[paths.Length]; for (int idx = 0; idx < paths.Length; idx++) { val[idx] = new FileSpec(new LocalPath(paths[idx]), null); } return(val); }
/// <summary> /// Create an array of FileSpec objects from a list of local paths /// </summary> /// <param name="paths">List of paths</param> /// <returns>List of FileSpec objects</returns> public static FileSpec[] LocalSpecArray(IList <String> paths) { FileSpec[] val = new FileSpec[paths.Count]; for (int idx = 0; idx < paths.Count; idx++) { val[idx] = new FileSpec(new LocalPath(paths[idx]), null); } return(val); }
/// <summary> /// Parameterized Constructor /// </summary> /// <param name="resolveaction">Resolve Action</param> /// <param name="resolvebasefile">Base File</param> /// <param name="resolvefromfile">From File</param> /// <param name="resolvestartfromrev">Start From Revision</param> /// <param name="resolveendfromrev">End From Revision</param> public FileResolveAction (ResolveAction resolveaction, FileSpec resolvebasefile, FileSpec resolvefromfile, int resolvestartfromrev, int resolveendfromrev) { ResolveAction = resolveaction; ResolveBaseFile = resolvebasefile; ResolveFromFile = resolvefromfile; ResolveStartFromRev = resolvestartfromrev; ResolveEndFromRev = resolveendfromrev; }
public DepotFileDiff(DiffType type, FileSpec leftfile, FileSpec rightfile, string diff ) { Type = type; LeftFile = leftfile; RightFile = rightfile; Diff = diff; }
public FileIntegrationRecord ( FileSpec fromfile, FileSpec tofile, IntegrateAction how, int changeid ) { FromFile = fromfile; ToFile = tofile; How = how; ChangeId = changeid; }
/// <summary> /// Constructor for FileMetaData given a FileSpec /// This command is "lossy" not all FileMetaData will be valid /// </summary> /// <param name="f">FileSpec</param> public FileMetaData(FileSpec f) { MovedFile = null; IsMapped = false; Shelved = false; HeadAction = FileAction.None; HeadChange = -1; HeadRev = -1; HeadType = null; HeadTime = DateTime.MinValue; HeadModTime = DateTime.MinValue; MovedRev = -1; Revision rev = f.Version as Revision; if (rev != null) { HaveRev = rev.Rev; } else { HaveRev = -1; } Desc = null; Digest = null; FileSize = -1; Action = FileAction.None; Type = null; ActionOwner = null; Change = -1; Resolved = false; Unresolved = false; Reresolvable = false; OtherOpen = 0; OtherOpenUserClients = null; OtherLock = false; OtherLockUserClients = null; OtherActions = null; OtherChanges = null; OurLock = false; ResolveRecords = null; Attributes = null; AttributesProp = null; AttributeDigests = null; OpenAttributes = null; OpenAttributesProp = null; Directory = null; TotalFileCount = -1; DepotPath = f.DepotPath; ClientPath = f.ClientPath; }
/// <summary> /// Get a list of streams from the repository /// </summary> /// <param name="options">options for the streams command<see cref="StreamsCmdOptions"/></param> /// <param name="files">files to filter results by</param> /// <returns>A list containing the matching streams</returns> /// <remarks> /// <br/><b>p4 help streams</b> /// <br/> /// <br/> streams -- Display list of streams /// <br/> /// <br/> p4 streams [-U -F filter -T fields -m max] [streamPath ...] /// <br/> /// <br/> Reports the list of all streams currently known to the system. If /// <br/> a 'streamPath' argument is specified, the list of streams is limited /// <br/> to those matching the supplied path. Unloaded task streams are not /// <br/> listed by default. /// <br/> /// <br/> For each stream, a single line of output lists the stream depot path, /// <br/> the type, the parent stream depot path, and the stream name. /// <br/> /// <br/> The -F filter flag limits the output to files satisfying the expression /// <br/> given as 'filter'. This filter expression is similar to the one used /// <br/> by 'jobs -e jobview', except that fields must match those above and /// <br/> are case sensitive. /// <br/> /// <br/> e.g. -F "Parent=//Ace/MAIN & Type=development" /// <br/> /// <br/> Note: the filtering takes place post-compute phase; there are no /// <br/> indexes to optimize performance. /// <br/> /// <br/> The -T fields flag (used with tagged output) limits the fields output /// <br/> to those specified by a list given as 'fields'. These field names can /// <br/> be separated by a space or a comma. /// <br/> /// <br/> e.g. -T "Stream, Owner" /// <br/> /// <br/> The -m max flag limits output to the first 'max' number of streams. /// <br/> /// <br/> The -U flag lists unloaded task streams (see 'p4 help unload'). /// <br/> /// <br/> /// </remarks> /// <example> /// To get the first 3 development type streams with the parent //flow/mainline: /// /// <code> /// IList<Stream> = rep.GetStreams(new Options(StreamsCmdFlags.None, /// "Parent=//flow/mainline & Type=development", null, "//...", 3)); /// </code> /// </example> public IList <Stream> GetStreams(Options options, params FileSpec[] files) { P4Command cmd = null; if ((files != null) && (files.Length > 0)) { cmd = new P4Command(this, "streams", true, FileSpec.ToStrings(files)); } else { cmd = new P4Command(this, "streams", true); } P4CommandResult results = cmd.Run(options); if (results.Success) { if ((results.TaggedOutput == null) || (results.TaggedOutput.Count <= 0)) { return(null); } List <Stream> value = new List <Stream>(); bool dst_mismatch = false; string offset = string.Empty; if (Server != null && Server.Metadata != null) { offset = Server.Metadata.DateTimeOffset; dst_mismatch = FormBase.DSTMismatch(Server.Metadata); } foreach (TaggedObject obj in results.TaggedOutput) { Stream stream = new Stream(); stream.FromStreamsCmdTaggedOutput(obj, offset, dst_mismatch); value.Add(stream); } return(value); } else { P4Exception.Throw(results.ErrorList); } return(null); }
/// <summary> /// Get a list of jobs from the repository /// </summary> /// <param name="options">options for the jobs command<see cref="JobsCmdFlags"/></param> /// <param name="files">list of files to filter jobs by</param> /// <returns>A list containing the matching jobs</returns> /// <remarks> /// <br/><b>p4 help jobs</b> /// <br/> /// <br/> jobs -- Display list of jobs /// <br/> /// <br/> p4 jobs [-e jobview -i -l -m max -r] [file[revRange] ...] /// <br/> p4 jobs -R /// <br/> /// <br/> Lists jobs in the server. If a file specification is included, fixes /// <br/> for submitted changelists affecting the specified files are listed. /// <br/> The file specification can include wildcards and a revision range. /// <br/> See 'p4 help revisions' for details about specifying revisions. /// <br/> /// <br/> The -e flag lists jobs matching the expression specified in the /// <br/> jobview parameter. For a description of jobview syntax, see 'p4 help /// <br/> jobview'. /// <br/> /// <br/> The -i flag includes any fixes made by changelists integrated into /// <br/> the specified files. /// <br/> /// <br/> The -l flag produces long output with the full text of the job /// <br/> descriptions. /// <br/> /// <br/> The -m max flag limits the output to the first 'max' jobs, ordered /// <br/> by their job name. /// <br/> /// <br/> The -r flag sorts the jobs in reverse order (by job name). /// <br/> /// <br/> The -R flag rebuilds the jobs table and reindexes each job, which /// <br/> is necessary after upgrading to 98.2. 'p4 jobs -R' requires that the /// <br/> user be an operator or have 'super' access granted by 'p4 protect'. /// <br/> /// <br/> /// </remarks> /// <example> /// /// To get a list of 100 jobs that include files under a given filepath: /// <code> /// /// FileSpec path = new FileSpec(new DepotPath(@"//depot/..."), null); /// IList<Job> jobs = rep.GetJobs((new Options(JobsCmdFlags.LongDescriptions, null, 100)), path); /// /// </code> /// /// To get a list of 100 jobs with the status "open": /// <code> /// /// string jobView = "status=open"; /// IList<Job> jobs = rep.GetJobs((new Options(JobsCmdFlags.LongDescriptions, jobView, 100)), path); /// /// </code> /// To get a list of 10 jobs in reverse order: /// <code> /// /// IList<Job> jobs = rep.GetJobs((new Options(JobsCmdFlags.ReverseSort, null, 10)); /// /// </code> /// /// To get a list of 10 jobs that include any fixes made by changelists integrated into /// the specified files: /// <code> /// /// FileSpec path = new FileSpec(new DepotPath(@"//depot/..."), null); /// IList<Job> jobs = rep.GetJobs((new Options(JobsCmdFlags.IncludeIntegratedFixes, null, 10)), path); /// /// </code> /// /// </example> /// <seealso cref="JobsCmdFlags"/> public IList <Job> GetJobs(Options options, params FileSpec[] files) { P4Command cmd = null; if ((files != null) && (files.Length > 0)) { cmd = new P4Command(this, "jobs", true, FileSpec.ToStrings(files)); } else { cmd = new P4Command(this, "jobs", true); } P4CommandResult results = cmd.Run(options); if (results.Success) { if ((results.TaggedOutput == null) || (results.TaggedOutput.Count <= 0)) { return(null); } List <Job> value = new List <Job>(); Dictionary <string, Job> map = new Dictionary <string, Job>(); foreach (TaggedObject obj in results.TaggedOutput) { Job job = new Job(); job.FromJobCmdTaggedOutput(obj); value.Add(job); } return(value); } else { P4Exception.Throw(results.ErrorList); } return(null); }
/// <summary> /// Read the fields from the tagged output of a diff command /// </summary> /// <param name="objectInfo">Tagged output from the 'diff' command</param> /// <param name="connection"></param> /// <param name="options"></param> public void FromGetFileDiffsCmdTaggedOutput(TaggedObject objectInfo, Connection connection, Options options) { FileDiff ParsedFileDiff = new FileDiff(); string depotfile = string.Empty; string clienttfile = string.Empty; int rev = -1; string type = string.Empty; if (objectInfo.ContainsKey("depotFile")) { depotfile = objectInfo["depotFile"]; } if (objectInfo.ContainsKey("clientFile")) { clienttfile = objectInfo["clientFile"]; } if (objectInfo.ContainsKey("rev")) { int.TryParse(objectInfo["rev"], out rev); } if (objectInfo.ContainsKey("type")) { Type = new FileType(objectInfo["type"]); } LeftFile = new FileSpec(new DepotPath(depotfile), new Revision(rev)); RightFile = new FileSpec(new DepotPath(clienttfile), null); Diff = connection.LastResults.TextOutput; ParsedFileDiff = new FileDiff(Type, LeftFile, RightFile, Diff); }
public FileSubmitRecord() { _action = FileAction.None; File = null; }
/// <summary> /// Given tagged output from an "fstat" command instantiate this object. /// </summary> /// <param name="obj">Tagged output from fstat</param> public void FromFstatCmdTaggedData(TaggedObject obj) { if (obj.ContainsKey("clientFile")) { string path = obj["clientFile"]; if (path.StartsWith("//")) { ClientPath = new ClientPath(obj["clientFile"]); } else { ClientPath = new ClientPath(obj["clientFile"]); LocalPath = new LocalPath(obj["clientFile"]); } } if (obj.ContainsKey("path")) { LocalPath = new LocalPath(obj["path"]); } if (obj.ContainsKey("depotFile")) { string p = PathSpec.UnescapePath(obj["depotFile"]); DepotPath = new DepotPath(p); } if (obj.ContainsKey("movedFile")) { MovedFile = new DepotPath(obj["movedFile"]); if (obj.ContainsKey("movedRev")) { int movedrev = -1; if (int.TryParse(obj["movedRev"], out movedrev)) { MovedRev = movedrev; } } } if (obj.ContainsKey("isMapped")) { IsMapped = true; } if (obj.ContainsKey("shelved")) { Shelved = true; } if (obj.ContainsKey("headAction")) { _headAction = obj["headAction"]; } if (obj.ContainsKey("headChange")) { int r = -1; if (int.TryParse(obj["headChange"], out r)) { HeadChange = r; } } if (obj.ContainsKey("headRev")) { int r = -1; if (int.TryParse(obj["headRev"], out r)) { HeadRev = r; } } if (obj.ContainsKey("headType")) { HeadType = new FileType(obj["headType"]); } if (obj.ContainsKey("headTime")) { HeadTime = FormBase.ConvertUnixTime(obj["headTime"]); } if (obj.ContainsKey("headModTime")) { HeadModTime = FormBase.ConvertUnixTime(obj["headModTime"]); } if (obj.ContainsKey("haveRev")) { int r = -1; if ((int.TryParse(obj["haveRev"], out r)) && (r > 0)) { HaveRev = r; } } if (obj.ContainsKey("desc")) { Desc = obj["desc"]; } if (obj.ContainsKey("digest")) { Digest = obj["digest"]; } if (obj.ContainsKey("fileSize")) { long s = -1; if (long.TryParse(obj["fileSize"], out s)) { FileSize = s; } } if (obj.ContainsKey("action")) { _action = obj["action"]; } if (obj.ContainsKey("type")) { Type = new FileType(obj["type"]); } else if (obj.ContainsKey("headType")) { // If not on mapped in current client, will not have //the Type filed so User the HeadType Type = new FileType(obj["headType"]); } else { Type = new FileType(BaseFileType.Text, FileTypeModifier.None); } if (obj.ContainsKey("actionOwner")) { ActionOwner = obj["actionOwner"]; } if (obj.ContainsKey("change")) { int c = -1; if (int.TryParse(obj["change"], out c)) { Change = c; } else { Change = 0; } } if (obj.ContainsKey("resolved")) { Resolved = true; } if (obj.ContainsKey("unresolved")) { Unresolved = true; } if (obj.ContainsKey("reresolvable")) { Reresolvable = true; } if (obj.ContainsKey("otherLock")) { OtherLock = true; } if (obj.ContainsKey("otherOpen")) { int cnt = 0; if (int.TryParse(obj["otherOpen"], out cnt)) { OtherOpen = cnt; OtherLockUserClients = new List <string>(); } if (cnt > 0) { OtherUsers = new OtherUsers(); OtherOpenUserClients = new List <String>(); OtherActions = new List <FileAction>(); OtherChanges = new List <int>(); for (int idx = 0; idx < cnt; idx++) { string key = String.Format("otherOpen{0}", idx); string otherClientName = null; OtherFileUser ofi = null; if (obj.ContainsKey(key)) { otherClientName = obj[key]; OtherOpenUserClients.Add(otherClientName); } ofi = OtherUsers[otherClientName]; ofi.Client = otherClientName; key = String.Format("otherAction{0}", idx); if (obj.ContainsKey(key)) { StringEnum <FileAction> otheraction = obj[key]; OtherActions.Add(otheraction); ofi.Action = otheraction; } key = String.Format("otherChange{0}", idx); if (obj.ContainsKey(key)) { int otherchange; if (!int.TryParse(obj[key], out otherchange)) { otherchange = 0; } OtherChanges.Add(otherchange); ofi.ChangelistId = otherchange; } key = String.Format("otherLock{0}", idx); if (obj.ContainsKey(key)) { string s = obj[key]; OtherLockUserClients.Add(s); OtherUsers[s].hasLock = true; } } } } if (obj.ContainsKey("ourLock")) { OurLock = true; } if (obj.ContainsKey("resolved") || obj.ContainsKey("unresolved")) { int idx = 0; StringEnum <ResolveAction> resolveaction = ResolveAction.Unresolved; FileSpec resolvebasefile = null; FileSpec resolvefromfile = null; int resolvestartfromrev = -1; int resolveendfromrev = -1; FileResolveAction resolverecord = null; ResolveRecords = new List <FileResolveAction>(); while (true) { string key = String.Format("resolveAction{0}", idx); if (obj.ContainsKey(key)) { resolveaction = obj[key]; } else { break; } key = String.Format("resolveBaseFile{0}", idx); if (obj.ContainsKey(key)) { string basefile = obj[key]; int resolvebaserev = -1; int.TryParse(obj[String.Format("resolveBaseRev{0}", idx)], out resolvebaserev); resolvebasefile = new FileSpec(new DepotPath(basefile), new Revision(resolvebaserev)); } else { break; } key = String.Format("resolveFromFile{0}", idx); if (obj.ContainsKey(key)) { string fromfile = obj[key]; int startfromrev, endfromrev = -1; int.TryParse(obj[String.Format("resolveStartFromRev{0}", idx)], out startfromrev); int.TryParse(obj[String.Format("resolveEndFromRev{0}", idx)], out endfromrev); resolvefromfile = new FileSpec(new DepotPath(fromfile), new VersionRange(new Revision(startfromrev), new Revision(endfromrev))); } else { break; } resolverecord = new FileResolveAction (resolveaction, resolvebasefile, resolvefromfile, resolvestartfromrev, resolveendfromrev); ResolveRecords.Add(resolverecord); idx++; } } Attributes = new Dictionary <string, object>(); foreach (string key in obj.Keys) { if (key.StartsWith("attr-")) { object val = obj[key]; string atrib = key.Replace("attr-", ""); Attributes.Add(atrib, val); } } AttributesProp = new Dictionary <string, object>(); foreach (string key in obj.Keys) { if (key.StartsWith("attrProp-")) { object val = obj[key]; string atrib = key.Replace("attrProp-", ""); AttributesProp.Add(atrib, val); } } AttributeDigests = new Dictionary <string, object>(); foreach (string key in obj.Keys) { if (key.StartsWith("attrDigest-")) { object val = obj[key]; string atribDigest = key.Replace("attrDigest-", ""); AttributeDigests.Add(atribDigest, val); } } OpenAttributes = new Dictionary <string, object>(); foreach (string key in obj.Keys) { if (key.StartsWith("openattr-")) { object val = obj[key]; string atrib = key.Replace("openattr-", ""); OpenAttributes.Add(atrib, val); } } OpenAttributesProp = new Dictionary <string, object>(); foreach (string key in obj.Keys) { if (key.StartsWith("openattrProp-")) { object val = obj[key]; string atrib = key.Replace("openattrProp-", ""); OpenAttributesProp.Add(atrib, val); } } if (obj.ContainsKey("totalFileCount")) { long s = -1; if (long.TryParse(obj["totalFileCount"], out s)) { TotalFileCount = s; } } if (obj.ContainsKey("dir")) { Directory = PathSpec.UnescapePath(obj["dir"]); } }
public void ParseIntegratedCmdTaggedData(TaggedObject obj) { DepotPath tp = null; VersionSpec starttorev = null; VersionSpec endtorev = null; if (obj.ContainsKey("toFile")) { string p = PathSpec.UnescapePath(obj["toFile"]); tp = new DepotPath(p); } if (obj.ContainsKey("startToRev")) { string str = obj["startToRev"]; starttorev = new Revision(-1); if (str.StartsWith("#h") | str.StartsWith("#n")) { if (str.Contains("#none")) { starttorev = Revision.None; } if (str.Contains("#have")) { starttorev = Revision.Have; } if (str.Contains("#head")) { starttorev = Revision.Head; } } else { str = str.Trim('#'); int rev = Convert.ToInt16(str); starttorev = new Revision(rev); } } if (obj.ContainsKey("endToRev")) { string etr = obj["endToRev"]; endtorev = new Revision(-1); if (etr.StartsWith("#h") | etr.StartsWith("#n")) { if (etr.Contains("#none")) { endtorev = Revision.None; } if (etr.Contains("#have")) { endtorev = Revision.Have; } if (etr.Contains("#head")) { endtorev = Revision.Head; } } else { etr = etr.Trim('#'); int rev = Convert.ToInt16(etr); endtorev = new Revision(rev); } } ToFile = new FileSpec(tp, null, null, new VersionRange(starttorev, endtorev)); DepotPath fp = null; VersionSpec startfromrev = null; VersionSpec endfromrev = null; if (obj.ContainsKey("fromFile")) { string p = PathSpec.UnescapePath(obj["fromFile"]); fp = new DepotPath(p); } if (obj.ContainsKey("startFromRev")) { string sfr = obj["startFromRev"]; startfromrev = new Revision(-1); if (sfr.StartsWith("#h") | sfr.StartsWith("#n")) { if (sfr.Contains("#none")) { startfromrev = Revision.None; } if (sfr.Contains("#have")) { startfromrev = Revision.Have; } if (sfr.Contains("#head")) { startfromrev = Revision.Head; } } else { sfr = sfr.Trim('#'); int rev = Convert.ToInt16(sfr); startfromrev = new Revision(rev); } } if (obj.ContainsKey("endFromRev")) { string efr = obj["endFromRev"]; endfromrev = new Revision(-1); if (efr.StartsWith("#h") | efr.StartsWith("#n")) { if (efr.Contains("#none")) { endfromrev = Revision.None; } if (efr.Contains("#have")) { endfromrev = Revision.Have; } if (efr.Contains("#head")) { endfromrev = Revision.Head; } } else { efr = efr.Trim('#'); int rev = Convert.ToInt16(efr); endfromrev = new Revision(rev); } } FromFile = new FileSpec(fp, null, null, new VersionRange(startfromrev, endfromrev)); if (obj.ContainsKey("how")) { How = (IntegrateAction) new StringEnum <IntegrateAction>(obj["how"], true, true); } if (obj.ContainsKey("change")) { int change = -1; int.TryParse(obj["change"], out change); ChangeId = change; } }
/// <summary> /// Compare this FileSpec with another /// </summary> /// <param name="obj">Object to compare to</param> /// <returns>true if they match</returns> public override bool Equals(object obj) { if ((obj is FileSpec) == false) { return(false); } FileSpec o = obj as FileSpec; if (o.ClientPath != null) { if (o.ClientPath.Equals(this.ClientPath) == false) { return(false); } } else { if (this.ClientPath != null) { return(false); } } if (o.DepotPath != null) { if (o.DepotPath.Equals(this.DepotPath) == false) { return(false); } } else { if (this.DepotPath != null) { return(false); } } if (o.LocalPath != null) { if (o.LocalPath.Equals(this.LocalPath) == false) { return(false); } } else { if (this.LocalPath != null) { return(false); } } if (o.Version != null) { if (o.Version.Equals(this.Version) == false) { return(false); } } else { if (this.Version != null) { return(false); } } return(true); }
public FileAnnotation(FileSpec file, string line) { File = file; Line = line; }
public FileSubmitRecord(FileAction action, FileSpec file) { _action = action; File = file; }
/// <summary> /// Expand the directory by filling in the list of child directories /// and file within the directory. /// </summary> /// <returns>false if an error prevented completion</returns> public bool Expand() { if (String.IsNullOrEmpty(depotPath)) { return(false); } // if we have the depot path, get a list of the subdirectories from the depot if (!String.IsNullOrEmpty(depotPath)) { IList <string> subdirs = _repository.GetDepotDirs(null, String.Format("{0}/*", depotPath)); if ((subdirs != null) && (subdirs.Count > 0)) { subdirectories = P4DirectoryMap.FromDirsOutput(_repository, Workspace, this, subdirs); foreach (P4Directory dir in subdirectories.Values) { dir.InDepot = true; } } IList <FileMetaData> fileList = _repository.GetFileMetaData(null, FileSpec.DepotSpec(String.Format("{0}/*", depotPath))); // get a list of the files in the directory if (fileList != null) { files = P4FileMap.FromFstatOutput(fileList); // if the directory contains files from the depot, we can use // the local path of one of those files to determine the local // path for this directory if ((String.IsNullOrEmpty(localPath)) && (files != null) && (files.Count > 0)) { foreach (FileMetaData f in files.Values) { if ((f.LocalPath != null) && !String.IsNullOrEmpty(f.LocalPath.Path)) { localPath = f.LocalPath.GetDirectoryName(); break; } } } } } // if we have a workspace and a local path, match the files and // subdirectories in the depot with the files in the file system if ((!String.IsNullOrEmpty(localPath)) && (Workspace != null)) { DirectoryInfo[] directoryList = null; FileInfo[] fileList = null; try { DirectoryInfo di = new DirectoryInfo(localPath); directoryList = di.GetDirectories(); fileList = di.GetFiles(); } catch (Exception ex) { //LogFile.LogException( "Initializing Directory from Workspace", ex ); } // get the subdirectories listed in the file and match them up // with the one in the list from the depot if ((directoryList != null) && (directoryList.Length > 0)) { foreach (DirectoryInfo di in directoryList) { string itemName = di.Name; if (subdirectories.ContainsKey(itemName)) { subdirectories[itemName].InWorkspace = true; } else { P4Directory subDir = new P4Directory(_repository, Workspace, itemName, null, di.FullName, parentDirectory); subDir.InDepot = false; subDir.InWorkspace = true; subdirectories[itemName] = subDir; } } } // get the files listed in the subdirectory and match them up // with the one in the list from the depot if ((fileList != null) && (fileList.Length > 0)) { foreach (FileInfo fi in fileList) { string itemName = fi.Name; if (files.ContainsKey(itemName) == false) { FileMetaData file = new FileMetaData(); file.LocalPath = new LocalPath(fi.FullName); file.DepotPath = null; file.FileSize = fi.Length; files[itemName] = file; } } } } return(true); }
/// <summary> /// Read the fields from the tagged output of a 'streams' command /// </summary> /// <param name="objectInfo">Tagged output from the 'streams' command</param> /// <param name="offset">Date processing</param> /// <param name="dst_mismatch">DST for date</param> public void FromStreamsCmdTaggedOutput(TaggedObject objectInfo, string offset, bool dst_mismatch) { _baseForm = new FormBase(); _baseForm.SetValues(objectInfo); if (objectInfo.ContainsKey("Stream")) { Id = objectInfo["Stream"]; } if (objectInfo.ContainsKey("Update")) { DateTime UTC = FormBase.ConvertUnixTime(objectInfo["Update"]); 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 (objectInfo.ContainsKey("Access")) { DateTime UTC = FormBase.ConvertUnixTime(objectInfo["Access"]); 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 (objectInfo.ContainsKey("Owner")) { OwnerName = objectInfo["Owner"]; } if (objectInfo.ContainsKey("Name")) { Name = objectInfo["Name"]; } if (objectInfo.ContainsKey("Parent")) { Parent = new DepotPath(objectInfo["Parent"]); } if (objectInfo.ContainsKey("baseParent")) { BaseParent = new DepotPath(objectInfo["baseParent"]); } if (objectInfo.ContainsKey("Type")) { _type = (objectInfo["Type"]); } if (objectInfo.ContainsKey("desc")) { Description = objectInfo["desc"]; } if (objectInfo.ContainsKey("Options")) { String optionsStr = objectInfo["Options"]; _options = optionsStr; } if (objectInfo.ContainsKey("firmerThanParent")) { FirmerThanParent = objectInfo["firmerThanParent"]; } if (objectInfo.ContainsKey("changeFlowsToParent")) { ChangeFlowsToParent = objectInfo["changeFlowsToParent"]; } if (objectInfo.ContainsKey("changeFlowsFromParent")) { ChangeFlowsFromParent = objectInfo["changeFlowsFromParent"]; } int idx = 0; string key = String.Format("Paths{0}", idx); if (objectInfo.ContainsKey(key)) { ViewMap Paths = new ViewMap(); StringEnum <MapType> map = null; PathSpec LeftPath = null; PathSpec RightPath = null; MapEntry Path = new MapEntry(map, LeftPath, RightPath); while (objectInfo.ContainsKey(key)) { string l = (objectInfo[key]); string[] p = l.Split(' '); map = p[0]; LeftPath = new DepotPath(p[1]); RightPath = new DepotPath(p[2]); Path = new MapEntry(map, LeftPath, RightPath); Paths.Add(Path); idx++; key = String.Format("Paths{0}", idx); } } idx = 0; key = String.Format("Remapped{0}", idx); if (objectInfo.ContainsKey(key)) { ViewMap Remapped = new ViewMap(); PathSpec LeftPath = null; PathSpec RightPath = null; MapEntry Remap = new MapEntry(MapType.Include, LeftPath, RightPath); while (objectInfo.ContainsKey(key)) { string l = (objectInfo[key]); string[] p = l.Split(' '); LeftPath = new DepotPath(p[0]); RightPath = new DepotPath(p[1]); Remap = new MapEntry(MapType.Include, LeftPath, RightPath); Remapped.Add(Remap); idx++; key = String.Format("Remapped{0}", idx); } } idx = 0; key = String.Format("Ignored{0}", idx); if (objectInfo.ContainsKey(key)) { List <FileSpec> Ignored = new List <FileSpec>(); FileSpec ignore = new FileSpec(new DepotPath(string.Empty), null); while (objectInfo.ContainsKey(key)) { string i = (objectInfo[key]); ignore = new FileSpec(new DepotPath(i), null); Ignored.Add(ignore); idx++; key = String.Format("Remapped{0}", idx); } } else { Ignored = null; } }
public RevisionIntegrationSummary(FileSpec fromfile, string how) { FromFile = fromfile; How = how; }
public FileResolveRecord(FileAction action, FileSpec baseFile, FileSpec fromFile) { Action = action; BaseFileSpec = baseFile; FromFileSpec = fromFile; }