Exemplo n.º 1
0
 public XmlChangedRecordReport(FileInRevision parentFileInRevision, FileInRevision childFileInRevision, XmlNode parent, XmlNode child,string url)
     : base(parentFileInRevision, childFileInRevision)
 {
     _parent = parent;
     _child = child;
     _url = url;
 }
 //  private readonly XmlNode _deletedNode;
 public ErrorDeterminingChangeReport(FileInRevision parent, FileInRevision child, XmlNode parentNode, XmlNode childNode, Exception error)
     : base(parent, child)
 {
     _parentNode = parentNode;
     _childNode = childNode;
     _error = error;
 }
		public IEnumerable<IChangeReport> Find2WayDifferences(FileInRevision parent, FileInRevision child, HgRepository repository)
		{
			var diffReports = new List<IChangeReport>(1);

			// The only relevant change to report is the version number.
			var childData = child.GetFileContents(repository);
			var splitData = SplitData(childData);
			var childModelNumber = Int32.Parse(splitData[1]);
			if (parent == null)
			{
				diffReports.Add(new FieldWorksModelVersionAdditionChangeReport(child, childModelNumber));
			}
			else
			{
				var parentData = parent.GetFileContents(repository);
				splitData = SplitData(parentData);
				var parentModelNumber = Int32.Parse(splitData[1]);
				if (parentModelNumber != childModelNumber)
					diffReports.Add(new FieldWorksModelVersionUpdatedReport(parent, child, parentModelNumber, childModelNumber));
				else
					throw new InvalidOperationException("The version number has downgraded");
			}

			return diffReports;
		}
		public IEnumerable<IChangeReport> Find2WayDifferences(FileInRevision parent, FileInRevision child, HgRepository repository)
		{
			return Xml2WayDiffService.ReportDifferences(
				repository,
				parent,
				child,
				SharedConstants.Header,
				SharedConstants.WfiWordform, SharedConstants.GuidStr);
		}
		public IEnumerable<IChangeReport> Find2WayDifferences(FileInRevision parent, FileInRevision child, HgRepository repository)
		{
			return Xml2WayDiffService.ReportDifferences(
				repository,
				parent,
				child,
				null,
				SharedConstants.MoMorphData, SharedConstants.GuidStr);
		}
Exemplo n.º 6
0
        public IEnumerable<IChangeReport> DescribeInitialContents(FileInRevision fileInRevision, TempFile file)
        {
            var dom = new XmlDocument();
            dom.Load(file.Path);

            foreach (XmlNode e in dom.SafeSelectNodes("notes/annotation"))
            {
                yield return new XmlAdditionChangeReport(fileInRevision, e);
            }
        }
Exemplo n.º 7
0
        private Xml2WayDiffer(HgRepository repository, IMergeEventListener eventListener, FileInRevision parent, FileInRevision child,
			string firstElementMarker,
			string startTag, string identfierAttribute)
        {
            _diffingMode = DiffingMode.FromFileInRevisions;
            _repository = repository;
            _parentFileInRevision = parent;
            _childFileInRevision = child;
            if (!string.IsNullOrEmpty(firstElementMarker))
                _firstElementTag = firstElementMarker.Trim();
            _startTag = "<" + startTag.Trim();
            _identfierAttribute = identfierAttribute;
            _eventListener = eventListener;
        }
		internal static Dictionary<string, byte[]> GetDataFromRevision(FileInRevision revision, HgRepository repository)
		{
			var doc = XDocument.Parse(revision.GetFileContents(repository));
			var data = doc.Root.Elements("layout")
				.ToDictionary(layoutElement =>
							  layoutElement.Attribute("class").Value + layoutElement.Attribute("type").Value + layoutElement.Attribute("name").Value,
							  layoutElement => SharedConstants.Utf8.GetBytes(layoutElement.ToString()));

			var layoutTypeElement = doc.Root.Element("layoutType");
			if (layoutTypeElement != null)
				data.Add("layoutType", SharedConstants.Utf8.GetBytes(doc.Root.Element("layoutType").ToString()));

			return data;
		}
Exemplo n.º 9
0
        /// <summary>
        /// Report the differences between two versions of files in the repository.
        /// </summary>
        /// <returns>Zero or more change reports.</returns>
        public static IEnumerable<IChangeReport> ReportDifferences(HgRepository repository,
			FileInRevision parent, FileInRevision child,
			string firstElementMarker,
            string recordMarker, string identfierAttribute)
        {
            var changeAndConflictAccumulator = new ChangeAndConflictAccumulator();
            // Pulls the files out of the repository so we can read them.
            var differ = Xml2WayDiffer.CreateFromFileInRevision(
                parent,
                child,
                changeAndConflictAccumulator,
                repository,
                firstElementMarker,
                recordMarker,
                identfierAttribute);

            differ.ReportDifferencesToListener();

            return changeAndConflictAccumulator.Changes;
        }
Exemplo n.º 10
0
 public IEnumerable<IChangeReport> Find2WayDifferences(FileInRevision parent, FileInRevision child, HgRepository repository)
 {
     return new IChangeReport[] { new DefaultChangeReport(parent, child, "Edited") };
 }
 public IEnumerable<IChangeReport> Find2WayDifferences(FileInRevision parent, FileInRevision child, HgRepository repository)
 {
     return Xml2WayDiffService.ReportDifferences(repository, parent, child,
         null,
         SharedConstants.CustomField, Key);
 }
Exemplo n.º 12
0
 public IEnumerable<IChangeReport> Find2WayDifferences(FileInRevision parent, FileInRevision child, HgRepository repository)
 {
     throw new ApplicationException(string.Format("Chorus could not find a handler to diff files like '{0}'", child.FullPath));
 }
Exemplo n.º 13
0
 private Lift2WayDiffer(IMergeStrategy mergeStrategy, string parentXml, string childXml , IMergeEventListener listener, FileInRevision parentFileInRevision, FileInRevision childFileInRevision)
     : this(mergeStrategy,parentXml, childXml, listener)
 {
     _parentFileInRevision = parentFileInRevision;
     _childFileInRevision = childFileInRevision;
 }
Exemplo n.º 14
0
 public XmlAttributeChangedReport(FileInRevision parentFileInRevision, FileInRevision childFileInRevision, XmlAttribute editedAttribute, string url)
     : base(parentFileInRevision, childFileInRevision, editedAttribute, url)
 {
 }
Exemplo n.º 15
0
 public XmlAttributeBothMadeSameChangeReport(FileInRevision fileInRevision, XmlAttribute editedChilAttribute, string url)
     : base(null, fileInRevision, editedChilAttribute, url)
 {
 }
Exemplo n.º 16
0
 public XmlAttributeBothAddedReport(FileInRevision fileInRevision, XmlAttribute addedChildAttribute, string url)
     : base(null, fileInRevision, addedChildAttribute, url)
 {
 }
Exemplo n.º 17
0
 public TextEditChangeReport(FileInRevision parent, FileInRevision child, string before, string after)
     : base(parent, child)
 {
     _before = before;
     _after = after;
 }
Exemplo n.º 18
0
 public TextEditChangeReport(FileInRevision fileInRevision, string before, string after)
     : base(null, fileInRevision)
 {
     _before = before;
     _after = after;
 }
Exemplo n.º 19
0
 public IEnumerable<IChangeReport> Find2WayDifferences(FileInRevision parent, FileInRevision child, HgRepository repository)
 {
     return Xml2WayDiffService.ReportDifferences(repository, parent, child, "header", "entry", "guid");
 }
		public IEnumerable<IChangeReport> Find2WayDifferences(FileInRevision parent, FileInRevision child, HgRepository repository)
		{
			return Xml2WayDiffService.ReportDifferences(
				parent, CustomLayoutDataCollectorMethod.GetDataFromRevision(parent, repository),
				child, CustomLayoutDataCollectorMethod.GetDataFromRevision(child, repository));
		}
Exemplo n.º 21
0
 public static Lift2WayDiffer CreateFromFileInRevision(IMergeStrategy mergeStrategy, FileInRevision parent, FileInRevision child, IMergeEventListener eventListener, HgRepository repository)
 {
     return new Lift2WayDiffer(mergeStrategy, parent.GetFileContents(repository), child.GetFileContents(repository), eventListener, parent, child);
 }
Exemplo n.º 22
0
 /// <summary>
 /// This is like a diff, but for when the file is first checked in.  So, for example, a dictionary
 /// handler might list any the words that were already in the dictionary when it was first checked in.
 /// </summary>
 public IEnumerable<IChangeReport> DescribeInitialContents(FileInRevision fileInRevision, TempFile file)
 {
     return new IChangeReport[] { new DefaultChangeReport(fileInRevision, "Added") };
 }
		///<summary>
		/// Constructor.
		///</summary>
		internal FieldWorksModelVersionUpdatedReport(FileInRevision parentFileInRevision, FileInRevision childFileInRevision, int oldModelVersion, int newModelVersion)
			: base(parentFileInRevision, childFileInRevision, newModelVersion)
		{
			OldModelVersion = oldModelVersion;
		}
Exemplo n.º 24
0
 public IEnumerable<IChangeReport> DescribeInitialContents(FileInRevision fileInRevision, TempFile file)
 {
     //this is never called because we said we don't present diffs; review is handled some other way
     throw new NotImplementedException();
 }
Exemplo n.º 25
0
 protected XmlAttributeChange(FileInRevision parent, FileInRevision child, XmlAttribute affectedAttribute, string url)
     : base(parent, child)
 {
     if (affectedAttribute == null) throw new ArgumentNullException("affectedAttribute");
     _affectedAttribute = affectedAttribute;
     _url = url;
 }
Exemplo n.º 26
0
 public IEnumerable<IChangeReport> Find2WayDifferences(FileInRevision parent, FileInRevision child, HgRepository repository)
 {
     //this is never called because we said we don't do diffs yet; review is handled some other way
     throw new NotImplementedException();
 }
Exemplo n.º 27
0
 public XmlAttributeChangedReport(FileInRevision parentFileInRevision, FileInRevision childFileInRevision, XmlAttribute editedAttribute)
     : this(parentFileInRevision, childFileInRevision, editedAttribute, string.Empty)
 {
 }
 public IEnumerable<IChangeReport> Find2WayDifferences(FileInRevision parent, FileInRevision child, HgRepository repository)
 {
     throw new NotSupportedException("'Find2WayDifferences' method is not supported for unknown file types.");
 }
Exemplo n.º 29
0
 public XmlAttributeBothDeletedReport(FileInRevision fileInRevision, XmlAttribute ancestorAttribute, string url)
     : base(null, fileInRevision, ancestorAttribute, url)
 {
 }
Exemplo n.º 30
0
 public IEnumerable<IChangeReport> Find2WayDifferences(FileInRevision parent, FileInRevision child, HgRepository repository)
 {
     return Xml2WayDiffService.ReportDifferences(repository, parent, child, null, "annotation", "guid")
         .Where(change => !(change is XmlDeletionChangeReport)); // Remove any deletion reports.
 }