@@ -52,6 +52,7 @@ def _fetch_all_from_remote(self, repo: Repo, remote: str) -> None:
52
52
raise e
53
53
54
54
def sync (self , destination_url : str , operations : list [SyncOperation ]) -> None :
55
+ logger .debug (f"Syncing { operations } to { destination_url } " )
55
56
repo = self ._get_clone_repo ()
56
57
destination_remote = f"hg::{ destination_url } "
57
58
@@ -69,9 +70,12 @@ def sync(self, destination_url: str, operations: list[SyncOperation]) -> None:
69
70
op for op in operations if isinstance (op , SyncBranchOperation )
70
71
]
71
72
for branch_operation in branch_ops :
72
- push_args .append (
73
- f"{ branch_operation .source_commit } :refs/heads/branches/{ branch_operation .destination_branch } /tip"
74
- )
73
+ try :
74
+ push_args .append (
75
+ f"{ branch_operation .source_commit } :refs/heads/branches/{ branch_operation .destination_branch } /tip"
76
+ )
77
+ except Exception as e :
78
+ raise RepoSyncError (branch_operation , e ) from e
75
79
76
80
# Add mercurial metadata to new commits from synced branches
77
81
# Some of these commits could be tagged in the same synchronization and
@@ -104,16 +108,20 @@ def sync(self, destination_url: str, operations: list[SyncOperation]) -> None:
104
108
if not self ._commit_has_mercurial_metadata (
105
109
repo , tag_operation .source_commit
106
110
):
107
- raise MercurialMetadataNotFoundError ()
108
- repo .git .cinnabar (
109
- [
110
- "tag" ,
111
- "--onto" ,
112
- f"refs/heads/{ tag_operation .tags_destination_branch } " ,
113
- tag_operation .tag ,
114
- tag_operation .source_commit ,
115
- ]
116
- )
117
-
111
+ raise MercurialMetadataNotFoundError (tag_operation )
112
+ try :
113
+ repo .git .cinnabar (
114
+ [
115
+ "tag" ,
116
+ "--onto" ,
117
+ f"refs/heads/{ tag_operation .tags_destination_branch } " ,
118
+ tag_operation .tag ,
119
+ tag_operation .source_commit ,
120
+ ]
121
+ )
122
+ except Exception as e :
123
+ raise RepoSyncError (tag_operation , e ) from e
124
+
125
+ logger .debug (f"Push arguments: { push_args } " )
118
126
# Push commits, branches and tags to destination
119
127
repo .git .push (* push_args )
0 commit comments