@@ -104,6 +104,8 @@ public static Synchronizer FromProjectConfiguration(ProjectFolderConfiguration p
104104
105105 public SyncResults SyncNow ( SyncOptions options )
106106 {
107+ using var activity = LibChorusActivitySource . Value . StartActivity ( ) ;
108+
107109 SyncResults results = new SyncResults ( ) ;
108110 List < RepositoryAddress > sourcesToTry = options . RepositorySourcesToTry ;
109111 // this saves us from trying to connect twice to the same repo that is, for example, not there.
@@ -156,12 +158,14 @@ public SyncResults SyncNow(SyncOptions options)
156158 error . DoNotifications ( Repository , _progress ) ;
157159 results . Succeeded = false ;
158160 results . ErrorEncountered = error ;
161+ activity ? . AddException ( error ) ;
159162 }
160163 catch ( UserCancelledException )
161164 {
162165 results . Succeeded = false ;
163166 results . Cancelled = true ;
164167 results . ErrorEncountered = null ;
168+ activity ? . SetTag ( "app.chorus.sync.cancelled" , true ) ;
165169 }
166170 catch ( Exception error )
167171 {
@@ -178,6 +182,7 @@ public SyncResults SyncNow(SyncOptions options)
178182
179183 results . Succeeded = false ;
180184 results . ErrorEncountered = error ;
185+ activity ? . AddException ( error ) ;
181186 }
182187 finally
183188 {
@@ -245,6 +250,7 @@ public void SetIsOneOfDefaultSyncAddresses(RepositoryAddress address, bool enabl
245250
246251 private void SendToOthers ( HgRepository repo , List < RepositoryAddress > sourcesToTry , Dictionary < RepositoryAddress , bool > connectionAttempt )
247252 {
253+ using var activity = LibChorusActivitySource . Value . StartActivity ( ) ;
248254 foreach ( RepositoryAddress address in sourcesToTry )
249255 {
250256 ThrowIfCancelPending ( ) ;
@@ -325,6 +331,7 @@ private void SendToOneOther(RepositoryAddress address, Dictionary<RepositoryAddr
325331 /// <returns>true if there was at least one successful pull</returns>
326332 private bool PullFromOthers ( HgRepository repo , List < RepositoryAddress > sourcesToTry , Dictionary < RepositoryAddress , bool > connectionAttempt )
327333 {
334+ using var activity = LibChorusActivitySource . Value . StartActivity ( ) ;
328335 bool didGetFromAtLeastOneSource = false ;
329336 foreach ( RepositoryAddress source in new List < RepositoryAddress > ( sourcesToTry ) ) // LT-18276: apparently possible to modify sourcesToTry
330337 {
@@ -628,6 +635,7 @@ private void TryToMakeCloneForSource(RepositoryAddress repoDescriptor)
628635 #region Merging
629636 private void MergeHeadsOrRollbackAndThrow ( HgRepository repo , Revision workingRevBeforeSync )
630637 {
638+ using var activity = LibChorusActivitySource . Value . StartActivity ( ) ;
631639 try
632640 {
633641 MergeHeads ( ) ;
@@ -642,6 +650,7 @@ private void MergeHeadsOrRollbackAndThrow(HgRepository repo, Revision workingRev
642650 _progress . WriteException ( error ) ;
643651 _progress . WriteError ( "Rolling back..." ) ;
644652 UpdateToTheDescendantRevision ( repo , workingRevBeforeSync ) ; //rollback
653+ activity ? . AddException ( error ) ;
645654 throw ;
646655 }
647656 }
0 commit comments