Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 10-05-2022, 12:32 PM   #16
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
DiapDealer is online now   Reply With Quote
Old 10-05-2022, 12:48 PM   #17
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
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?
KevinH is online now   Reply With Quote
Old 10-05-2022, 01:35 PM   #18
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,599
Karma: 204624552
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by KevinH View Post
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.
Oh, for sure. I was thinking of something where a pre-installed git would be a prerequisite that the plugin could then use. But the plugin was always going to be a last ditch scenario anyway.

Quote:
Originally Posted by KevinH View Post
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?
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.
DiapDealer is online now   Reply With Quote
Old 10-05-2022, 02:47 PM   #19
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
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.
KevinH is online now   Reply With Quote
Old 10-06-2022, 11:51 AM   #20
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
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.
KevinH is online now   Reply With Quote
Old 10-06-2022, 11:54 AM   #21
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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!
DiapDealer is online now   Reply With Quote
Old 10-06-2022, 12:33 PM   #22
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
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.
KevinH is online now   Reply With Quote
Old 10-13-2022, 01:54 PM   #23
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
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.
KevinH is online now   Reply With Quote
Old 10-13-2022, 07:26 PM   #24
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,797
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by KevinH View Post
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.
Many thanks Kevin and Diap!
RbnJrg is offline   Reply With Quote
Old 10-16-2022, 10:42 AM   #25
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
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.
KevinH is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 07:17 PM.


MobileRead.com is a privately owned, operated and funded community.