Feat: sync deleted files in Bitbucket (#14450)

### What problem does this PR solve?

Feat: sync deleted files in Bitbucket

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
Magicbook1108
2026-04-29 11:29:17 +08:00
committed by GitHub
parent 74fa54f122
commit 3b7a6eaa6c
3 changed files with 12 additions and 6 deletions

View File

@@ -355,10 +355,7 @@ if __name__ == "__main__":
start_time = datetime.fromtimestamp(0, tz=timezone.utc)
end_time = datetime.now(timezone.utc)
for doc_batch in bitbucket.retrieve_all_slim_docs_perm_sync(
start=start_time.timestamp(),
end=end_time.timestamp(),
):
for doc_batch in bitbucket.retrieve_all_slim_docs_perm_sync():
for doc in doc_batch:
print(doc)

View File

@@ -1334,12 +1334,17 @@ class Bitbucket(SyncBase):
"bitbucket_api_token": self.conf["credentials"].get("bitbucket_api_token"),
}
)
file_list = None
if task["reindex"] == "1" or not task["poll_range_start"]:
start_time = datetime.fromtimestamp(0, tz=timezone.utc)
_begin_info = "totally"
else:
start_time = task.get("poll_range_start")
if self.conf.get("sync_deleted_files"):
file_list = []
for slim_batch in self.connector.retrieve_all_slim_docs_perm_sync():
file_list.extend(slim_batch)
_begin_info = f"from {start_time}"
end_time = datetime.now(timezone.utc)
@@ -1371,7 +1376,8 @@ class Bitbucket(SyncBase):
yield batch
self.log_connection("Bitbucket", f"workspace({self.conf.get('workspace')})", task)
if file_list is not None:
return wrapper(), file_list
return wrapper()

View File

@@ -58,7 +58,7 @@ export const DataSourceFeatureVisibilityMap = {
[DataSourceKey.GITHUB]: {
syncDeletedFiles: true,
},
[DataSourceKey.GOOGLE_DRIVE]: {
[DataSourceKey.GOOGLE_DRIVE]: {
syncDeletedFiles: true,
},
[DataSourceKey.CONFLUENCE]: {
@@ -85,6 +85,9 @@ export const DataSourceFeatureVisibilityMap = {
[DataSourceKey.JIRA]: {
syncDeletedFiles: true,
},
[DataSourceKey.BITBUCKET]: {
syncDeletedFiles: true,
},
[DataSourceKey.AIRTABLE]: {
syncDeletedFiles: true,
},