static private GetIndexFileName ( string fileName ) : string | ||
fileName | string | |
return | string |
public RemotePack(string lockMessage, List <PackLock> packLocks, ObjectChecker oC, Repository r, WalkRemoteObjectDatabase c, string pn) { _lockMessage = lockMessage; _packLocks = packLocks; _objCheck = oC; _local = r; DirectoryInfo objdir = _local.ObjectsDirectory; _connection = c; PackName = pn; _idxName = IndexPack.GetIndexFileName(PackName.Slice(0, PackName.Length - 5)); string tn = _idxName; if (tn.StartsWith("pack-")) { tn = tn.Substring(5); } if (tn.EndsWith(IndexPack.IndexSuffix)) { tn = tn.Slice(0, tn.Length - 4); } TmpIdx = new FileInfo(Path.Combine(objdir.ToString(), "walk-" + tn + ".walkidx")); }
public override List <string> getPackNames() { var packs = new List <string>(); try { var list = new List <ChannelSftp.LsEntry>(); foreach (object o in _ftp.ls("pack")) { list.Add((ChannelSftp.LsEntry)o); } var files = new Dictionary <string, ChannelSftp.LsEntry>(); var mtimes = new Dictionary <string, int>(); foreach (ChannelSftp.LsEntry ent in list) { files.Add(ent.getFilename(), ent); } foreach (ChannelSftp.LsEntry ent in list) { string n = ent.getFilename(); if (!n.StartsWith("pack-") || n.EndsWith(IndexPack.PackSuffix)) { continue; } string @in = IndexPack.GetIndexFileName(n.Slice(0, n.Length - 5)); if (!files.ContainsKey(@in)) { continue; } mtimes.Add(n, ent.getAttrs().getMTime()); packs.Add(n); } packs.Sort((a, b) => mtimes[a] - mtimes[b]); } catch (SftpException je) { throw new TransportException("Can't ls " + _objectsPath + "/pack: " + je.message, je); } return(packs); }