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

« back to all changes in this revision

Viewing changes to external/ngit/NGit/NGit.Api/PullCommand.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:
85
85
                /// command. Don't call this method twice on an instance.
86
86
                /// </summary>
87
87
                /// <returns>the result of the pull</returns>
88
 
                /// <exception cref="NGit.Api.Errors.WrongRepositoryStateException"></exception>
89
 
                /// <exception cref="NGit.Api.Errors.InvalidConfigurationException"></exception>
90
 
                /// <exception cref="NGit.Api.Errors.DetachedHeadException"></exception>
91
 
                /// <exception cref="NGit.Api.Errors.InvalidRemoteException"></exception>
92
 
                /// <exception cref="NGit.Api.Errors.CanceledException"></exception>
93
 
                /// <exception cref="NGit.Api.Errors.RefNotFoundException"></exception>
94
 
                /// <exception cref="NGit.Api.Errors.NoHeadException"></exception>
 
88
                /// <exception cref="NGit.Api.Errors.WrongRepositoryStateException">NGit.Api.Errors.WrongRepositoryStateException
 
89
                ///     </exception>
 
90
                /// <exception cref="NGit.Api.Errors.InvalidConfigurationException">NGit.Api.Errors.InvalidConfigurationException
 
91
                ///     </exception>
 
92
                /// <exception cref="NGit.Api.Errors.DetachedHeadException">NGit.Api.Errors.DetachedHeadException
 
93
                ///     </exception>
 
94
                /// <exception cref="NGit.Api.Errors.InvalidRemoteException">NGit.Api.Errors.InvalidRemoteException
 
95
                ///     </exception>
 
96
                /// <exception cref="NGit.Api.Errors.CanceledException">NGit.Api.Errors.CanceledException
 
97
                ///     </exception>
 
98
                /// <exception cref="NGit.Api.Errors.RefNotFoundException">NGit.Api.Errors.RefNotFoundException
 
99
                ///     </exception>
 
100
                /// <exception cref="NGit.Api.Errors.NoHeadException">NGit.Api.Errors.NoHeadException
 
101
                ///     </exception>
 
102
                /// <exception cref="NGit.Api.Errors.TransportException">NGit.Api.Errors.TransportException
 
103
                ///     </exception>
 
104
                /// <exception cref="NGit.Api.Errors.GitAPIException">NGit.Api.Errors.GitAPIException
 
105
                ///     </exception>
95
106
                public override PullResult Call()
96
107
                {
97
108
                        CheckCallable();
226
237
                                                , e);
227
238
                                }
228
239
                        }
 
240
                        string upstreamName = "branch \'" + Repository.ShortenRefName(remoteBranchName) +
 
241
                                 "\' of " + remoteUri;
229
242
                        PullResult result;
230
243
                        if (doRebase)
231
244
                        {
232
245
                                RebaseCommand rebase = new RebaseCommand(repo);
233
 
                                try
234
 
                                {
235
 
                                        RebaseResult rebaseRes = rebase.SetUpstream(commitToMerge).SetProgressMonitor(monitor
236
 
                                                ).SetOperation(RebaseCommand.Operation.BEGIN).Call();
237
 
                                        result = new PullResult(fetchRes, remote, rebaseRes);
238
 
                                }
239
 
                                catch (NoHeadException e)
240
 
                                {
241
 
                                        throw new JGitInternalException(e.Message, e);
242
 
                                }
243
 
                                catch (RefNotFoundException e)
244
 
                                {
245
 
                                        throw new JGitInternalException(e.Message, e);
246
 
                                }
247
 
                                catch (JGitInternalException e)
248
 
                                {
249
 
                                        throw new JGitInternalException(e.Message, e);
250
 
                                }
251
 
                                catch (GitAPIException e)
252
 
                                {
253
 
                                        throw new JGitInternalException(e.Message, e);
254
 
                                }
 
246
                                RebaseResult rebaseRes = rebase.SetUpstream(commitToMerge).SetUpstreamName(upstreamName
 
247
                                        ).SetProgressMonitor(monitor).SetOperation(RebaseCommand.Operation.BEGIN).Call();
 
248
                                result = new PullResult(fetchRes, remote, rebaseRes);
255
249
                        }
256
250
                        else
257
251
                        {
258
252
                                MergeCommand merge = new MergeCommand(repo);
259
 
                                string name = "branch \'" + Repository.ShortenRefName(remoteBranchName) + "\' of "
260
 
                                         + remoteUri;
261
 
                                merge.Include(name, commitToMerge);
262
 
                                MergeCommandResult mergeRes;
263
 
                                try
264
 
                                {
265
 
                                        mergeRes = merge.Call();
266
 
                                        monitor.Update(1);
267
 
                                        result = new PullResult(fetchRes, remote, mergeRes);
268
 
                                }
269
 
                                catch (NoHeadException e)
270
 
                                {
271
 
                                        throw new JGitInternalException(e.Message, e);
272
 
                                }
273
 
                                catch (ConcurrentRefUpdateException e)
274
 
                                {
275
 
                                        throw new JGitInternalException(e.Message, e);
276
 
                                }
277
 
                                catch (NGit.Api.Errors.CheckoutConflictException e)
278
 
                                {
279
 
                                        throw new JGitInternalException(e.Message, e);
280
 
                                }
281
 
                                catch (InvalidMergeHeadsException e)
282
 
                                {
283
 
                                        throw new JGitInternalException(e.Message, e);
284
 
                                }
285
 
                                catch (WrongRepositoryStateException e)
286
 
                                {
287
 
                                        throw new JGitInternalException(e.Message, e);
288
 
                                }
289
 
                                catch (NoMessageException e)
290
 
                                {
291
 
                                        throw new JGitInternalException(e.Message, e);
292
 
                                }
 
253
                                merge.Include(upstreamName, commitToMerge);
 
254
                                MergeCommandResult mergeRes = merge.Call();
 
255
                                monitor.Update(1);
 
256
                                result = new PullResult(fetchRes, remote, mergeRes);
293
257
                        }
294
258
                        monitor.EndTask();
295
259
                        return result;