private void AADiffBaseVsMergedMI_Click(object sender, EventArgs e)
        {
            if ((sourceFile == null) || (!System.IO.File.Exists(sourceFile)))
            {
                sourceFile = new TempFile(_selectedItem.ResolveRecord.FromFileSpec);
                if (Scm.GetFileVersion(sourceFile, _selectedItem.ResolveRecord.FromFileSpec) == null)
                {
                    sourceFile.Dispose();
                    sourceFile = null;
                    return;
                }
            }

            if ((baseFile == null) || (!System.IO.File.Exists(baseFile)))
            {
                baseFile = new TempFile(_selectedItem.ResolveRecord.BaseFileSpec);
                if (Scm.GetFileVersion(baseFile, _selectedItem.ResolveRecord.BaseFileSpec) == null)
                {
                    baseFile.Dispose();
                    baseFile = null;
                    return;
                }
            }

            string targetFile = _selectedItem.ResolveRecord.LocalFilePath.Path;

            if ((mergedFile == null) || (!System.IO.File.Exists(mergedFile)))
            {
                string mergedFileName = string.Format("{0}(merged {1}[{2}]){3}",
                                                      System.IO.Path.GetFileNameWithoutExtension(_selectedItem.ResolveRecord.LocalFilePath.Path),
                                                      ((P4.VersionRange)_selectedItem.ResolveRecord.FromFileSpec.Version).Upper,
                                                      _selectedItem.ResolveRecord.BaseFileSpec.Version,
                                                      System.IO.Path.GetExtension(_selectedItem.ResolveRecord.LocalFilePath.Path));

                mergedFile = new TempFile(mergedFileName);

                if (Scm.MergeLocalFiles(baseFile, sourceFile, targetFile, mergedFile) == false)
                {
                    MessageBox.Show(Resources.ResolveFileInteractiveControl_CannotCreateMergedFile, Resources.PerforceSCM, MessageBoxButtons.OK);
                    mergedFile.Dispose();
                    mergedFile = null;
                    return;
                }
            }
            Scm.Diff2Files(baseFile,
                           string.Format(Resources.ResolveFileInteractiveControl_BaseFile,
                                         baseFile.ToString()),
                           mergedFile,
                           Resources.ResolveFileInteractiveControl_MergedSourceTarget);
        }
示例#2
0
        private void AADiffBaseVsMergedMI_Click(object sender, EventArgs e)
        {
            if (sourceFile == null)
            {
                sourceFile = new TempFile();
                if (Scm.GetFileVersion(sourceFile, _selectedItem.ResolveRecord.FromFileSpec) == null)
                {
                    return;
                }
            }

            if (baseFile == null)
            {
                baseFile = new TempFile();
                if (Scm.GetFileVersion(baseFile, _selectedItem.ResolveRecord.BaseFileSpec) == null)
                {
                    return;
                }
            }

            string targetFile = _selectedItem.ResolveRecord.LocalFilePath.Path;

            if (mergedFile == null)
            {
                mergedFile = new TempFile();

                if (Scm.MergeLocalFiles(baseFile, sourceFile, targetFile, mergedFile) == false)
                {
                    return;
                }
            }
            Scm.Diff2Files(baseFile,
                           string.Format("Base ({0})", baseFile.ToString()),
                           mergedFile,
                           "Merged Source/Target");
        }