/// <summary>
		/// 
		/// </summary>
		/// <param name="op"></param>
		/// <param name="hash"></param>
		/// <param name="commiter"></param>
		/// <param name="behavior"></param>
		/// <param name="sources"></param>
		/// <returns></returns>
		public static Commit Commit(this IMappingOperator op, string hash, string commiter, CommitHeadBehavior behavior, params string[] sources) {
			var commit = new Commit {Hash = hash, Author = new CommitAuthorInfo {Commiter = commiter, Time = DateTime.Now}};
			if (null != sources && 0 != sources.Length) {
				foreach (var s in sources) {
					commit.Sources.Add(s);
				}
			}
			return op.Commit(commit,behavior);
		}
 /// <summary>
 ///     Дескриптор файла, основанный на хранилище DirtyVersion
 /// </summary>
 public FileDirtyVersionBased(IDirtyVersionStorage storage, Commit commit) {
     _dirtyVersionStorage = storage;
     Commit = commit;
     Descriptor = new FileDescriptor {
         Path = commit.MappingInfo.Name,
         Owner = (commit.Author != null) ? (commit.Author.Commiter) : (null),
         Version = commit.Hash
     };
 }
示例#3
0
		private void PropagateMergedState(Commit c,bool self) {
			if(self)c.HeadState = HeadState.Merged;
			if (c.HasSources()) {
				foreach (var s in c.Sources) {
					var sc = Resolve(s);
					if(null!=sc)PropagateMergedState(sc,true);
				}
			}
		}
示例#4
0
		private void MergeAuthors(Commit commit) {
			if (commit.Author.Time > Author.Time) {
				if (commit.Author.Commiter != Author.Commiter) {
					CoAuthors.Add(Author);
					Author = commit.Author;
				}
			}
			else {
				if (!CoAuthors.Contains(commit.Author)) {
					commit.CoAuthors.Add(commit.Author);
				}
			}
		}
示例#5
0
		/// <summary>
		/// Применить исходники
		/// </summary>
		/// <param name="commit"></param>
		public void MergeSources(Commit commit) {
			if (commit.HasSources()) {
				if (!HasSources()) {
					SourceType = commit.SourceType;
					foreach (var s in commit.Sources) {
						Sources.Add(s);
					}
				}
				else {
					var additions = commit.Sources.Except(Sources).ToArray();
					if (0 != additions.Length) {
						SourceType = CommitSourceType.Merged;
						foreach (var s in additions) {
							Sources.Add(s);
						}
					}
				}
			}
		}
示例#6
0
		/// <summary>
		/// Сведение коммитов
		/// </summary>
		/// <param name="commit"></param>
		public void Merge(Commit commit) {
			MergeAuthors(commit);
			MergeSources(commit);
		}