internal static string GetItemName(PendingChange pendingChange, bool useServerPath)
 {
     if (useServerPath || string.IsNullOrEmpty(pendingChange.LocalItem))
     {
         return(VersionControlPath.GetFileName(pendingChange.ServerItem));
     }
     return(FileSpec.GetFileName(pendingChange.LocalItem));
 }
        internal static string GetOriginalName(PendingChange pendingChange, bool useServerPath)
        {
            string x        = null;
            var    itemName = GetItemName(pendingChange, useServerPath);

            if (!string.IsNullOrEmpty(pendingChange.SourceLocalItem) && !string.IsNullOrEmpty(pendingChange.LocalItem))
            {
                x = FileSpec.GetFileName(pendingChange.SourceLocalItem);
                if (
                    !FileSpec.Equals(FileSpec.GetDirectoryName(pendingChange.SourceLocalItem),
                                     FileSpec.GetDirectoryName(pendingChange.LocalItem)))
                {
                    x = pendingChange.SourceLocalItem;
                }
                if (string.Equals(x, itemName, StringComparison.Ordinal))
                {
                    x = null;
                }
            }
            if (x == null && !string.IsNullOrEmpty(pendingChange.SourceServerItem) &&
                !string.IsNullOrEmpty(pendingChange.ServerItem))
            {
                x = VersionControlPath.GetFileName(pendingChange.SourceServerItem);
                if (
                    !VersionControlPath.Equals(VersionControlPath.GetFolderName(pendingChange.SourceServerItem),
                                               VersionControlPath.GetFolderName(pendingChange.ServerItem)))
                {
                    x = pendingChange.SourceServerItem;
                }
                if (string.Equals(x, itemName, StringComparison.Ordinal))
                {
                    x = null;
                }
            }
            return(x);
        }