Exemple #1
0
        public SourceControlStatus GetStatus(IResource sc)
        {
            if (sc == null)
            {
                return(SourceControlStatus.FileDoesNotExist);
            }

            return
                (!CanUseSourceControl
                    ? SourceControlStatus.FileDoesNotExist
                    : SourceControlService.GetStatus(sc.Uri));
        }
        /// <summary>
        /// Perform the Reconcile command</summary>
        /// <param name="doing">True to perform the Reconcile; false to test whether Reconcile can be done</param>
        /// <returns>True iff Reconcile can be done or was done</returns>
        protected override bool DoReconcile(bool doing)
        {
            if (SourceControlService == null || SourceControlContext == null)
            {
                return(false);
            }

            if (!doing)
            {
                return(SourceControlContext.Resources.Any());
            }

            var uris            = SourceControlContext.Resources.Select(resource => resource.Uri).ToList();
            var modified        = new List <Uri>();
            var localNotInDepot = new List <Uri>();

            //using (new WaitCursor())
            {
                foreach (Uri uri in SourceControlService.GetModifiedFiles(uris))
                {
                    if (SourceControlService.GetStatus(uri) != SourceControlStatus.CheckedOut)
                    {
                        modified.Add(uri);
                    }
                }

                foreach (Uri uri in uris)
                {
                    if (!modified.Contains(uri))
                    {
                        if (SourceControlService.GetStatus(uri) == SourceControlStatus.NotControlled)
                        {
                            localNotInDepot.Add(uri);
                        }
                    }
                }
            }

            var vm = new ReconcileViewModel(SourceControlService, modified, localNotInDepot);

            DialogUtils.ShowDialogWithViewModel <ReconcileDialog>(vm);

            return(true);
        }