예제 #1
0
		public bool FetchDiff (Push push)
		{
			string url = null;
			try {
				string response = CachingFetcher.FetchDiff (push.CHAuthID, push.Repository.Owner.Name, push.Repository.Name, ID, out url);
				if (response == null)
					return false;
				
				var jdes = new JsonDeserializer ();
				var wrapper = jdes.Deserialize<CommitWithDiffJsonWrapper> (response);
				if (wrapper != null) {
					var diff = wrapper.Commit;
					if (!diff.FetchBlobs (push)) {
						Log (LogSeverity.Error, "Failed to fetch blobs for commit '{0}' from URL '{1}'", ID, url);
						return false;
					}
					Diff = diff;
				} else {
					Log (LogSeverity.Error, "Failed to fetch diff for commit '{0}' from URL '{1}'", ID, url);
					return false;
				}
			} catch (Exception ex) {
				Log (ex, "Exception while fetching diff for commit '{4}' from URL '{5}'\n{0}", ID, url);
				return false;
			}
			
			CommitWithDiff ret = Diff;
			if (ret == null)
				Log (LogSeverity.Info, "FetchDiff did not fail, but no diff retrieved?");
			
			return ret != null;
		}
예제 #2
0
        public bool FetchDiff(Push push)
        {
            string url = null;

            try {
                string response = CachingFetcher.FetchDiff(push.CHAuthID, push.Repository.Owner.Name, push.Repository.Name, ID, out url);
                if (response == null)
                {
                    return(false);
                }

                var jdes    = new JsonDeserializer();
                var wrapper = jdes.Deserialize <CommitWithDiffJsonWrapper> (response);
                if (wrapper != null)
                {
                    var diff = wrapper.Commit;
                    if (!diff.FetchBlobs(push))
                    {
                        Log(LogSeverity.Error, "Failed to fetch blobs for commit '{0}' from URL '{1}'", ID, url);
                        return(false);
                    }
                    Diff = diff;
                }
                else
                {
                    Log(LogSeverity.Error, "Failed to fetch diff for commit '{0}' from URL '{1}'", ID, url);
                    return(false);
                }
            } catch (Exception ex) {
                Log(ex, "Exception while fetching diff for commit '{4}' from URL '{5}'\n{0}", ID, url);
                return(false);
            }

            CommitWithDiff ret = Diff;

            if (ret == null)
            {
                Log(LogSeverity.Info, "FetchDiff did not fail, but no diff retrieved?");
            }

            return(ret != null);
        }