Fossil

Check-in [1392710f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:print stash metadata when popping or applying stash

Feature request from Alfred M. Szmidt in ae3ad9c69f. Minor tweak of original patch by stephan@

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1392710fb455840c17e9d8de7cd7d498ae4cb91acbf78896fb880974135ae341
User & Date: mark 2022-09-27 11:11:17
Context
2022-09-27
13:47
Fix a bug in the chat-robot. ... (check-in: b3f87ef7 user: drh tags: trunk)
11:11
print stash metadata when popping or applying stash

Feature request from Alfred M. Szmidt in ae3ad9c69f. Minor tweak of original patch by stephan@ ... (check-in: 1392710f user: mark tags: trunk)

2022-09-26
22:29
Replaced most of the speculation in the walmode section of the containers doc with a link to the walbanger project, where we'll be answering this question. ... (check-in: 96633067 user: wyoung tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/stash.c.

691
692
693
694
695
696
697
698



699
700
701
702
703
704
705
706
707
708
709





710
711










712

713
714
715
716
717
718
719
    }else{
      undo_begin();
      undo_save_stash(0);
      stash_drop(stashid);
      undo_finish();
    }
  }else
  if( memcmp(zCmd, "pop", nCmd)==0 ){



    if( g.argc>3 ) usage("pop");
    stashid = stash_get_id(0);
    undo_begin();
    stash_apply(stashid, 0);
    undo_save_stash(stashid);
    undo_finish();
    stash_drop(stashid);
  }else
  if( memcmp(zCmd, "apply", nCmd)==0 ){
    if( g.argc>4 ) usage("apply STASHID");
    stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0);





    undo_begin();
    stash_apply(stashid, 0);










    undo_finish();

  }else
  if( memcmp(zCmd, "goto", nCmd)==0 ){
    int nConflict;
    int vid;
    if( g.argc>4 ) usage("apply STASHID");
    stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0);
    undo_begin();







|
>
>
>
|
|
<
<
<
<
<
|
<
|
|
>
>
>
>
>


>
>
>
>
>
>
>
>
>
>

>







691
692
693
694
695
696
697
698
699
700
701
702
703





704

705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
    }else{
      undo_begin();
      undo_save_stash(0);
      stash_drop(stashid);
      undo_finish();
    }
  }else
  if( memcmp(zCmd, "pop", nCmd)==0 ||  memcmp(zCmd, "apply", nCmd)==0 ){
    char *zCom = 0, *zDate = 0, *zHash = 0;
    int popped = *zCmd=='p';
    if( popped ){
      if( g.argc>3 ) usage("pop");
      stashid = stash_get_id(0);





    }else{

      if( g.argc>4 ) usage("apply STASHID");
      stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0);
    }
    zCom = db_text(0, "SELECT comment FROM stash WHERE stashid=%d", stashid);
    zDate = db_text(0, "SELECT datetime(ctime) FROM stash WHERE stashid=%d",
        stashid);
    zHash = db_text(0, "SELECT hash FROM stash WHERE stashid=%d", stashid);
    undo_begin();
    stash_apply(stashid, 0);
    if( popped ) undo_save_stash(stashid);
    fossil_print("%s stash:\n%5d: [%.14s] from %s\n",
        popped ? "Popped" : "Applied", stashid, zHash, zDate);
    if( zCom && *zCom ){
      fossil_print("       ");
      comment_print(zCom, 0, 7, -1, get_comment_format());
    }
    fossil_free(zCom);
    fossil_free(zDate);
    fossil_free(zHash);
    undo_finish();
    if( popped ) stash_drop(stashid);
  }else
  if( memcmp(zCmd, "goto", nCmd)==0 ){
    int nConflict;
    int vid;
    if( g.argc>4 ) usage("apply STASHID");
    stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0);
    undo_begin();