~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/ngit/NGit/NGit.Api/DiffCommand.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
*/
43
43
 
44
44
using System.Collections.Generic;
 
45
using System.IO;
45
46
using NGit;
46
47
using NGit.Api;
47
48
using NGit.Api.Errors;
50
51
using NGit.Internal;
51
52
using NGit.Treewalk;
52
53
using NGit.Treewalk.Filter;
 
54
using NGit.Util.IO;
53
55
using Sharpen;
54
56
 
55
57
namespace NGit.Api
97
99
                /// </summary>
98
100
                /// <returns>a DiffEntry for each path which is different</returns>
99
101
                /// <exception cref="NGit.Api.Errors.GitAPIException"></exception>
100
 
                /// <exception cref="System.IO.IOException"></exception>
101
102
                public override IList<DiffEntry> Call()
102
103
                {
103
 
                        DiffFormatter diffFmt = new DiffFormatter(new BufferedOutputStream(@out));
 
104
                        DiffFormatter diffFmt;
 
105
                        if (@out != null && !showNameAndStatusOnly)
 
106
                        {
 
107
                                diffFmt = new DiffFormatter(new BufferedOutputStream(@out));
 
108
                        }
 
109
                        else
 
110
                        {
 
111
                                diffFmt = new DiffFormatter(NullOutputStream.INSTANCE);
 
112
                        }
104
113
                        diffFmt.SetRepository(repo);
105
114
                        diffFmt.SetProgressMonitor(monitor);
106
115
                        try
140
149
                                        }
141
150
                                }
142
151
                                diffFmt.SetPathFilter(pathFilter);
143
 
                                if (contextLines >= 0)
144
 
                                {
145
 
                                        diffFmt.SetContext(contextLines);
146
 
                                }
147
 
                                if (destinationPrefix != null)
148
 
                                {
149
 
                                        diffFmt.SetNewPrefix(destinationPrefix);
150
 
                                }
151
 
                                if (sourcePrefix != null)
152
 
                                {
153
 
                                        diffFmt.SetOldPrefix(sourcePrefix);
154
 
                                }
155
152
                                IList<DiffEntry> result = diffFmt.Scan(oldTree, newTree);
156
153
                                if (showNameAndStatusOnly)
157
154
                                {
159
156
                                }
160
157
                                else
161
158
                                {
 
159
                                        if (contextLines >= 0)
 
160
                                        {
 
161
                                                diffFmt.SetContext(contextLines);
 
162
                                        }
 
163
                                        if (destinationPrefix != null)
 
164
                                        {
 
165
                                                diffFmt.SetNewPrefix(destinationPrefix);
 
166
                                        }
 
167
                                        if (sourcePrefix != null)
 
168
                                        {
 
169
                                                diffFmt.SetOldPrefix(sourcePrefix);
 
170
                                        }
162
171
                                        diffFmt.Format(result);
163
172
                                        diffFmt.Flush();
164
173
                                        return result;
165
174
                                }
166
175
                        }
 
176
                        catch (IOException e)
 
177
                        {
 
178
                                throw new JGitInternalException(e.Message, e);
 
179
                        }
167
180
                        finally
168
181
                        {
169
182
                                diffFmt.Release();