Esempio n. 1
0
        void DoFetch(SvnLogArgs args)
        {
            LogRequest rq = _currentRequest = null;

            ShowBusyIndicator();
            try
            {
                using (SvnClient client = _context.GetService <ISvnClientPool>().GetClient())
                {
                    SvnOrigin single = EnumTools.GetSingle(LogSource.Targets);
                    if (single != null)
                    {
                        // TODO: Use peg information
                    }
                    List <Uri> uris = new List <Uri>();
                    foreach (SvnOrigin o in LogSource.Targets)
                    {
                        uris.Add(o.Uri);
                    }

                    switch (_mode)
                    {
                    case LogMode.Log:
                        SvnLogArgs la = new SvnLogArgs();
                        la.AddExpectedError(
                            SvnErrorCode.SVN_ERR_CLIENT_UNRELATED_RESOURCES, // File not there, prevent exception
                            SvnErrorCode.SVN_ERR_UNSUPPORTED_FEATURE);       // Merge info from 1.4 server
                        la.Start                   = args.Start;
                        la.End                     = args.End;
                        la.Limit                   = args.Limit;
                        la.StrictNodeHistory       = args.StrictNodeHistory;
                        la.RetrieveMergedRevisions = args.RetrieveMergedRevisions;

                        _currentRequest = rq = new LogRequest(la, OnReceivedItem);
                        client.Log(uris, la, null);
                        break;

                    case LogMode.MergesEligible:
                        SvnMergesEligibleArgs meArgs = new SvnMergesEligibleArgs();
                        meArgs.AddExpectedError(
                            SvnErrorCode.SVN_ERR_CLIENT_UNRELATED_RESOURCES, // File not there, prevent exception
                            SvnErrorCode.SVN_ERR_UNSUPPORTED_FEATURE);       // Merge info from 1.4 server
                        meArgs.RetrieveChangedPaths = true;

                        _currentRequest = rq = new LogRequest(meArgs, OnReceivedItem);
                        client.ListMergesEligible(LogSource.MergeTarget.Target, single.Target, meArgs, null);
                        break;

                    case LogMode.MergesMerged:
                        SvnMergesMergedArgs mmArgs = new SvnMergesMergedArgs();
                        mmArgs.AddExpectedError(
                            SvnErrorCode.SVN_ERR_CLIENT_UNRELATED_RESOURCES, // File not there, prevent exception
                            SvnErrorCode.SVN_ERR_UNSUPPORTED_FEATURE);       // Merge info from 1.4 server
                        mmArgs.RetrieveChangedPaths = true;
                        _currentRequest             = rq = new LogRequest(mmArgs, OnReceivedItem);
                        client.ListMergesMerged(LogSource.MergeTarget.Target, single.Target, mmArgs, null);
                        break;
                    }
                }
            }
            finally
            {
                // Don't lock here, we can be called from within a lock
                if (rq == _currentRequest)
                {
                    _running = false;
                    OnBatchDone(rq);
                }
                HideBusyIndicator();
            }
        }