Closed trevorshannon closed 1 year ago
Updated per our discussion. I ran the same manual tests documented in the initial PR description, plus verified that no history gets moved if a job has user_visible_url
set when using --change-location
(because the guid does not change in that case)
The thing to note below is the absence of a string like "Moved {n} snapshots of...":
➜ urlwatch git:(feat/update-url) ✗ urlwatch --urls ~/urls.yaml --change-location 2 https://www.wikipedia.org
Moving location of <url url='https://www.example.org' user_visible_url='https://www.google.com'> to "https://www.wikipedia.org"
Saving updated list to '/home/trevor/urls.yaml'
Ok, all set. Thanks for the feedback!
Merged, thanks!
This PR adds a new command line option
--change-location
to change the location (i.e.url
,command
, ornavigate
) of a job while preserving history for that job. The tool ensures that the new location string is unique within the list of jobs prior to changing anything.Note that in the (admittedly contrived) scenario of having abandoned entries in a redis db that use the user-provided new location (perhaps from old runs that were never garbage-collected) then those abandoned entries will be clobbered by the
--change-location
option. I think that should be ok, but I'm sure I could find a way to preserve those entries if needed.I did some manual testing to verify functionality.
Save the starting version of a simple urls YAML:
Change location of all 4 jobs:
Compare the updated urls YAML to the initial reference version. Appropriate key values are updated according to job type:
Existing history is moved with --change-location:
I confirmed the same behavior with
--cache redis://127.0.0.1:6379
Fixes #300