Esempio n. 1
0
        /// <summary>
        /// This method will detect changed vs deleted file conflicts in the output coming from mercurial.
        /// It produces a conflict for that situation and tells mercurial to keep the changed file.
        /// <note>The default response for mercurial is to keep the changed, but on some user systems (Windows 8?)
        /// mercurial will pause waiting for input instead of using the default answer.</note>
        /// </summary>
        private bool HandleChangedVsDeletedFiles(string line, StreamWriter standardInput)
        {
            // The two situations we are dealing with are:
            //
            // local changed [filename] which remote deleted
            // use (c)hanged version or (d)elete?
            //		and
            // remote changed [filename] which local deleted
            // use (c)hanged version or leave (d)eleted?

            string changedVsDeletedFile = null;
            var    match = Regex.Match(line, @"local changed (.*) which remote deleted");

            if (match.Captures.Count > 0)
            {
                changedVsDeletedFile = match.Groups[1].Value;
            }
            else
            {
                match = Regex.Match(line, @"remote changed (.*) which local deleted");
                if (match.Captures.Count > 0)
                {
                    changedVsDeletedFile = match.Groups[1].Value;
                }
            }
            if (changedVsDeletedFile != null)
            {
                var conflictPath   = Path.Combine(_rootDirectory, changedVsDeletedFile);
                var conflictReport = new FileChangedVsFileDeletedConflict(conflictPath);
                using (var chorusNoteCreator = new ChorusNotesMergeEventListener(ChorusNotesMergeEventListener.GetChorusNotesFilePath(conflictPath)))
                {
                    chorusNoteCreator.ConflictOccurred(conflictReport);
                }
                return(true);
            }
            // Send hg the response it might be waiting for:
            if (line.Contains(@"(c)hanged") && line.Contains(@"(d)elete"))
            {
                standardInput.WriteLine('c');
                return(true);
            }
            // This input line was not related to a Changed vs Deleted File situation
            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// This method will detect changed vs deleted file conflicts in the output coming from mercurial.
        /// It produces a conflict for that situation and tells mercurial to keep the changed file.
        /// <note>The default response for mercurial is to keep the changed, but on some user systems (Windows 8?)
        /// mercurial will pause waiting for input instead of using the default answer.</note>
        /// </summary>
        private bool HandleChangedVsDeletedFiles(string line, StreamWriter standardInput)
        {
            // The two situations we are dealing with are:
            //
            // local changed [filename] which remote deleted
            // use (c)hanged version or (d)elete?
            //		and
            // remote changed [filename] which local deleted
            // use (c)hanged version or leave (d)eleted?

            string changedVsDeletedFile = null;
            var match = Regex.Match(line, @"local changed (.*) which remote deleted");
            if(match.Captures.Count > 0)
            {
                changedVsDeletedFile = match.Groups[1].Value;
            }
            else
            {
                match = Regex.Match(line, @"remote changed (.*) which local deleted");
                if(match.Captures.Count > 0)
                {
                    changedVsDeletedFile = match.Groups[1].Value;
                }
            }
            if(changedVsDeletedFile != null)
            {
                var conflictPath = Path.Combine(_rootDirectory, changedVsDeletedFile);
                var conflictReport = new FileChangedVsFileDeletedConflict(conflictPath);
                using(var chorusNoteCreator = new ChorusNotesMergeEventListener(ChorusNotesMergeEventListener.GetChorusNotesFilePath(conflictPath)))
                {
                    chorusNoteCreator.ConflictOccurred(conflictReport);
                }
                return true;
            }
            // Send hg the response it might be waiting for:
            if(line.Contains(@"(c)hanged") && line.Contains(@"(d)elete"))
            {
                standardInput.WriteLine('c');
                return true;
            }
            // This input line was not related to a Changed vs Deleted File situation
            return false;
        }