Skip to content

Commit ef3c488

Browse files
committed
Update 'git-obs pr dump' to remove 'metadata' directory with old data before an update
1 parent 5926857 commit ef3c488

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

osc/commands_git/pr_dump.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def clone_or_update(
9595

9696
def run(self, args):
9797
import json
98-
import re
98+
import shutil
9999
import sys
100100
from osc import gitea_api
101101
from osc import obs_api
@@ -236,6 +236,11 @@ def run(self, args):
236236
)
237237

238238
metadata_dir = os.path.join(path, "metadata")
239+
try:
240+
# remove old metadata first to ensure that we never keep any of the old files on an update
241+
shutil.rmtree(metadata_dir)
242+
except FileNotFoundError:
243+
pass
239244
os.makedirs(metadata_dir, exist_ok=True)
240245

241246
with open(os.path.join(metadata_dir, "obs-request.xml"), "wb") as f:

0 commit comments

Comments
 (0)