summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Gallo <aamsgallo@gmail.com>2021-10-04 14:32:41 +0200
committerAlejandro Gallo <aamsgallo@gmail.com>2021-10-04 14:32:41 +0200
commit341c371ec4ec5fc11a3bac0518b36220cf2f4750 (patch)
treee0a7589101462cfa6f402312ec0ae94c6176ae50
parent6fdeec3ec0492a104022ac17a870bc060baa4c02 (diff)
Pop files carefully
Oops!
-rw-r--r--papis/commands/merge.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/papis/commands/merge.py b/papis/commands/merge.py
index 48056228..ae02be9e 100644
--- a/papis/commands/merge.py
+++ b/papis/commands/merge.py
@@ -107,14 +107,18 @@ def cli(query: str,
logger.error("You have to pick exactly two documents!")
return
+
a = documents[0]
data_a = to_dict(a)
- data_a.pop("ref")
- data_a.pop("files")
b = documents[1]
data_b = to_dict(b)
- data_b.pop("ref")
- data_b.pop("files")
+
+ to_pop = ["files"]
+ for d in [data_a, data_b]:
+ for key in to_pop:
+ if key in d:
+ d.pop(key)
+
papis.utils.update_doc_from_data_interactively(data_a,
data_b,
papis.document.describe(b))