コード例 #1
0
        /// <summary>
        /// Mark the file as resolved, unresolved, or attempt to merge the file again. Afterwards,
        /// update the <see cref="State"/>.
        /// </summary>
        /// <param name="command">
        /// Any extra options to the resolve method, or <c>null</c> for default options.
        /// </param>
        /// <exception cref="System.InvalidOperationException">
        /// The <see cref="ResolveAction.List"/> action is invalid for this method.
        /// </exception>
        /// <remarks>
        /// Note that the <see cref="ResolveCommand.MergeTool"/> property is not overridden here,
        /// which means that a visual, third-party, merge tool might pop up and ask the user
        /// for help. To avoid this, override the merge tool yourself.
        /// </remarks>
        public void Resolve(ResolveCommand command = null)
        {
            command = (command ?? new ResolveCommand())
                      .WithFile(_Path);

            if (command.Action == ResolveAction.List)
            {
                throw new InvalidOperationException("The ResolveAction.List action is invalid for this method");
            }

            try
            {
                MergeJob.Repository.Resolve(command);
            }
            catch (MercurialExecutionException)
            {
                return;
            }

            IEnumerable <MergeConflict> conflictsAfterResolve = MergeJob.Repository.Resolve(new ResolveCommand().WithAction(ResolveAction.List));

            State =
                (from conflict in conflictsAfterResolve
                 where conflict.Path == _Path
                 select conflict.State).First();
        }
コード例 #2
0
ファイル: MergeConflict.cs プロジェクト: whir1/Hg.Net
        /// <summary>
        /// Initializes a new instance of the <see cref="MergeConflict"/> class.
        /// </summary>
        /// <param name="path">
        /// The path to the file that had a merge conflict.
        /// </param>
        /// <param name="state">
        /// The current state of the file.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="path"/> is <c>null</c> or empty.</para>
        /// </exception>
        public MergeConflict(string path, MergeConflictState state)
        {
            if (StringEx.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentNullException("path");
            }

            _Path  = path;
            _State = state;
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MergeJobConflict"/> class.
        /// </summary>
        /// <param name="mergeJob">
        /// The <see cref="MergeJob"/> that manages this <see cref="MergeJobConflict"/>.
        /// </param>
        /// <param name="path">
        /// The name of the file this <see cref="MergeJobConflict"/> relates to.
        /// </param>
        /// <param name="state">
        /// The initial state of the file.
        /// </param>
        /// <exception cref="System.ArgumentNullException">
        /// <para><paramref name="mergeJob"/> is <c>null</c>.</para>
        /// <para>- or -</para>
        /// <para><paramref name="path"/> is <c>null</c> or empty.</para>
        /// </exception>
        public MergeJobConflict(MergeJob mergeJob, string path, MergeConflictState state)
        {
            if (mergeJob == null)
            {
                throw new ArgumentNullException("mergeJob");
            }
            if (StringEx.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentNullException("path");
            }

            _MergeJob = mergeJob;
            _Path     = path;
            State     = state;
        }