![]() |
#16 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,599
Karma: 204624552
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
What about a "companion" edit plugin that uses a supplied git binary? That way, tag names and messages could be edited directly.
|
![]() |
![]() |
![]() |
#17 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,802
Karma: 6000000
Join Date: Nov 2009
Device: many
|
I think since we already keep additional info in the gitignored .bookinfo file we should probably go that way. I want to keep checkpoint code reasonably self contained and relying on compiling a binary git library for every platform is a bit too much in my opinion.
I guess we could revisit the idea of creating a checkpoint now prompting for a message but only if a settings says yes. But I really do not like that. So lets explore serializing a list of tags and tag messages to .bookinfo that can be easily parsed to supply that info first before moving on. How does that sound? |
![]() |
![]() |
![]() |
#18 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,599
Karma: 204624552
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
![]() Sounds good to me. It has the advantage of not having to manipulate the character limit on git messages where the overflow needs to go into an extended field. |
|
![]() |
![]() |
![]() |
#19 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,802
Karma: 6000000
Join Date: Nov 2009
Device: many
|
Or we use os.remove based on the old tag hash to clean up the old annotated tag file before adding the new one.
That might be doable. |
![]() |
![]() |
![]() |
#20 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,802
Karma: 6000000
Join Date: Nov 2009
Device: many
|
@DiapDealer
The more I think about it, the more I like your idea of going the tag delete and tag create approach with manually cleaning up the loose object (old Tag), at least that way the annotated tag itself stores the new message making it easier to work with real git if anyone likes to do that. I have created some code that should be close. I do not have a full build environment here on my laptop (I am at my cottage to celebrate Canadian Thanksgiving and then close it up). If you have any free time and access to checkpoint repos try playing around with this routine to see if it will do what we want. Otherwise in a week or so when I return home I will see if I can get that routine working (at least manually). Code:
def update_annotated_tag_message(localRepo, bookid, tagname, newmessage) repo_home = pathof(localRepo) repo_home = repo_home.replace("/", os.sep) repo_path = os.path.join(repo_home, "epub_" + bookid) cdir = os.getcwd() if os.path.exists(repo_path): os.chdir(repo_path) with open_repo_closing(".") as r: tag_name = utf8str(tagname) tags = sorted(r.refs.as_dict(b"refs/tags")) tagkey = b"refs/tags/" + tag_name if tag_name in tags: obj = r[tagkey] if isinstance(obj,Tag): # create a duplicate Tag with updated message nobj = Tag() nobj.tag_time = obj.tag_time nobj.tag_timezone = obj.tag_timezone nobj.message = utf8str(newmessage + "\n") nobj.name = obj.name nobj.tagger = obj.tagger nobj.object = obj.object old_sha = obj.sha # delete the old tag from the object store refs dictionary del r.refs[_make_tag_ref(tag_name)] # remove the old annotated object itself from the object store r.object_store._remove_loose_object(old_sha) # add in the updated tag to the object store r.object_store.add_object(nobj) # create a ref in the refs dictionary for the updated tag tag_id = nobj.id r.refs[_make_tag_ref(tag_name)] = tag_id os.chdir(cdir) Last edited by KevinH; 10-06-2022 at 12:09 PM. |
![]() |
![]() |
![]() |
#21 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,599
Karma: 204624552
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I'll play around with it as soon as soon as I can. Thanks!
|
![]() |
![]() |
![]() |
#22 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,802
Karma: 6000000
Join Date: Nov 2009
Device: many
|
The code above may need to pull in more dulwich internal stuff like porcelain.py does. Or I guess we could do the equivalent using porcelain tag_delete first (after copying everything from the old tag before we delete it, including its target commit object) and then using porcelain tag_create passing along the right things from the old tag with the new message. Then manually deleting the old tag file.
Feel free to use either approach. I just took the "good bits" from those routines and tried to use them directly. |
![]() |
![]() |
![]() |
#23 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,802
Karma: 6000000
Join Date: Nov 2009
Device: many
|
For those interested and following along, DiapDealer has pushed a version of this new feature request to Sigil master.
Please note, it may not be in final form yet. So if you build your own, feel free to checkout master. Once built, use the MainWindow Checkpoints menu to change a specific tags description. |
![]() |
![]() |
![]() |
#24 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,797
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#25 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,802
Karma: 6000000
Join Date: Nov 2009
Device: many
|
FYI, we have also just now added the Repo Log Summary to the MainWindow Checkpoint menu so that users can more easily see a summary of changed files between each Checkpoint made. It previously existed only on the Repo Manager dialog (and still does) but that was a bit buried.
Again, interested users who build on their own can use current master to play around with this feature change. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sigil version: 0.9.7 | increase | Sigil | 6 | 04-01-2020 09:53 AM |
Would it be possible for a next version of Sigil? | RbnJrg | Sigil | 24 | 02-17-2020 05:59 PM |
Is it feasible to build dictionary with opf2mobi/html2mobi? | EbokJunkie | Kindle Formats | 11 | 01-11-2014 07:51 PM |
Wikipedia (offline) Dictionary? Available? Feasible? | ivanatpr | Amazon Kindle | 2 | 10-22-2010 05:39 PM |