예제 #1
0
        private IList <string> UpdateFiles(IList <string> LocalPaths)
        {
            IList <string> updatedFiles = new List <string>();

            lock (cache)
            {
                P4.Options opts = new P4.Options();
                opts["-Olhp"] = null;
                IList <P4.FileMetaData> files = _repository.GetFileMetaData(P4.FileSpec.LocalSpecList(LocalPaths.ToArray()), opts);

                if ((files != null) && (files.Count > 0))
                {
                    foreach (P4.FileMetaData file in files)
                    {
                        var key = GetKey(file.LocalPath.Path);
                        if (cache.ContainsKey(key))
                        {
                            SourceControlStatus oldStat = cache[key].ScmStatus;
                            SourceControlStatus newStat = new SourceControlStatus(file);
                            if (oldStat.Flags != newStat.Flags)
                            {
                                cache[key] = new CachedFile(file);
                                updatedFiles.Add(file.LocalPath.Path);
                                logger.Trace("UpdateFiles: {0}", file.LocalPath.Path);
                            }
                        }
                        else
                        {
                            cache[key] = new CachedFile(file);
                            updatedFiles.Add(file.LocalPath.Path);
                            logger.Trace("UpdateFiles: {0}", file.LocalPath.Path);
                        }
                    }
                }
            }
            return(updatedFiles);
        }
예제 #2
0
 public CachedFile(P4.FileMetaData file)
 {
     _file      = file;
     ScmStatus  = new SourceControlStatus(file);
     LastUpdate = DateTime.Now;
 }