Exemplo n.º 1
0
        public IChangePresenter GetChangePresenter(IChangeReport report, HgRepository repository)
        {
            if (report == null)
            {
                throw new ArgumentNullException("report");
            }
            if (repository == null)
            {
                throw new ArgumentNullException("repository");
            }

            var extension = FileWriterService.GetExtensionFromPathname(report.PathToFile);

            return(GetHandlerfromExtension(extension).GetChangePresenter(report, repository));
        }
Exemplo n.º 2
0
        public IEnumerable <IChangeReport> Find2WayDifferences(FileInRevision parent, FileInRevision child, HgRepository repository)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");                 // Parent seems not be optional in Chorus usage.
            }
            if (child == null)
            {
                throw new ArgumentNullException("child");
            }
            if (repository == null)
            {
                throw new ArgumentNullException("repository");
            }

            var extension = FileWriterService.GetExtensionFromPathname(child.FullPath);

            return(GetHandlerfromExtension(extension).Find2WayDifferences(parent, child, repository));
        }
Exemplo n.º 3
0
        public void Do3WayMerge(MergeOrder mergeOrder)
        {
            if (mergeOrder == null)
            {
                throw new ArgumentNullException("mergeOrder");
            }

            // Make sure MDC is updated.
            // Since this method is called in another process by ChorusMerge,
            // the MDC that was set up for splitting the file is not available.
            var extension = FileWriterService.GetExtensionFromPathname(mergeOrder.pathToOurs);

            if (extension != SharedConstants.ModelVersion)
            {
                var pathToOurs = mergeOrder.pathToOurs;
                var folder     = Path.GetDirectoryName(pathToOurs);
                while (!File.Exists(Path.Combine(folder, SharedConstants.ModelVersionFilename)))
                {
                    var parent = Directory.GetParent(folder);
                    folder = parent != null?parent.ToString() : null;

                    if (folder == null)
                    {
                        break;
                    }
                }
                // 'folder' should now have the required model version file in it, or null for some tests.
                var desiredModelNumber = MetadataCache.MaximumModelVersion;
                if (folder != null)
                {
                    var ourModelFileData = File.ReadAllText(Path.Combine(folder, SharedConstants.ModelVersionFilename));
                    desiredModelNumber = Int32.Parse(ModelVersionFileTypeHandlerStrategy.SplitData(ourModelFileData)[1]);
                }
                MetadataCache.MdCache.UpgradeToVersion(desiredModelNumber);
            }

            XmlMergeService.RemoveAmbiguousChildNodes = false;             // Live on the edge. Opt out of that expensive code.

            GetHandlerfromExtension(extension).Do3WayMerge(MetadataCache.MdCache, mergeOrder);
        }