Fossil SCM
print stash metadata when popping or applying stash Feature request from Alfred M. Szmidt in [forum:ae3ad9c69f]. Minor tweak of original patch by stephan@
Commit
1392710fb455840c17e9d8de7cd7d498ae4cb91acbf78896fb880974135ae341
Parent
96633067d561ad4…
1 file changed
+28
-15
+28
-15
| --- src/stash.c | ||
| +++ src/stash.c | ||
| @@ -693,25 +693,38 @@ | ||
| 693 | 693 | undo_save_stash(0); |
| 694 | 694 | stash_drop(stashid); |
| 695 | 695 | undo_finish(); |
| 696 | 696 | } |
| 697 | 697 | }else |
| 698 | - if( memcmp(zCmd, "pop", nCmd)==0 ){ | |
| 699 | - if( g.argc>3 ) usage("pop"); | |
| 700 | - stashid = stash_get_id(0); | |
| 701 | - undo_begin(); | |
| 702 | - stash_apply(stashid, 0); | |
| 703 | - undo_save_stash(stashid); | |
| 704 | - undo_finish(); | |
| 705 | - stash_drop(stashid); | |
| 706 | - }else | |
| 707 | - if( memcmp(zCmd, "apply", nCmd)==0 ){ | |
| 708 | - if( g.argc>4 ) usage("apply STASHID"); | |
| 709 | - stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0); | |
| 710 | - undo_begin(); | |
| 711 | - stash_apply(stashid, 0); | |
| 712 | - undo_finish(); | |
| 698 | + if( memcmp(zCmd, "pop", nCmd)==0 || memcmp(zCmd, "apply", nCmd)==0 ){ | |
| 699 | + char *zCom = 0, *zDate = 0, *zHash = 0; | |
| 700 | + int popped = *zCmd=='p'; | |
| 701 | + if( popped ){ | |
| 702 | + if( g.argc>3 ) usage("pop"); | |
| 703 | + stashid = stash_get_id(0); | |
| 704 | + }else{ | |
| 705 | + if( g.argc>4 ) usage("apply STASHID"); | |
| 706 | + stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0); | |
| 707 | + } | |
| 708 | + zCom = db_text(0, "SELECT comment FROM stash WHERE stashid=%d", stashid); | |
| 709 | + zDate = db_text(0, "SELECT datetime(ctime) FROM stash WHERE stashid=%d", | |
| 710 | + stashid); | |
| 711 | + zHash = db_text(0, "SELECT hash FROM stash WHERE stashid=%d", stashid); | |
| 712 | + undo_begin(); | |
| 713 | + stash_apply(stashid, 0); | |
| 714 | + if( popped ) undo_save_stash(stashid); | |
| 715 | + fossil_print("%s stash:\n%5d: [%.14s] from %s\n", | |
| 716 | + popped ? "Popped" : "Applied", stashid, zHash, zDate); | |
| 717 | + if( zCom && *zCom ){ | |
| 718 | + fossil_print(" "); | |
| 719 | + comment_print(zCom, 0, 7, -1, get_comment_format()); | |
| 720 | + } | |
| 721 | + fossil_free(zCom); | |
| 722 | + fossil_free(zDate); | |
| 723 | + fossil_free(zHash); | |
| 724 | + undo_finish(); | |
| 725 | + if( popped ) stash_drop(stashid); | |
| 713 | 726 | }else |
| 714 | 727 | if( memcmp(zCmd, "goto", nCmd)==0 ){ |
| 715 | 728 | int nConflict; |
| 716 | 729 | int vid; |
| 717 | 730 | if( g.argc>4 ) usage("apply STASHID"); |
| 718 | 731 |
| --- src/stash.c | |
| +++ src/stash.c | |
| @@ -693,25 +693,38 @@ | |
| 693 | undo_save_stash(0); |
| 694 | stash_drop(stashid); |
| 695 | undo_finish(); |
| 696 | } |
| 697 | }else |
| 698 | if( memcmp(zCmd, "pop", nCmd)==0 ){ |
| 699 | if( g.argc>3 ) usage("pop"); |
| 700 | stashid = stash_get_id(0); |
| 701 | undo_begin(); |
| 702 | stash_apply(stashid, 0); |
| 703 | undo_save_stash(stashid); |
| 704 | undo_finish(); |
| 705 | stash_drop(stashid); |
| 706 | }else |
| 707 | if( memcmp(zCmd, "apply", nCmd)==0 ){ |
| 708 | if( g.argc>4 ) usage("apply STASHID"); |
| 709 | stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0); |
| 710 | undo_begin(); |
| 711 | stash_apply(stashid, 0); |
| 712 | undo_finish(); |
| 713 | }else |
| 714 | if( memcmp(zCmd, "goto", nCmd)==0 ){ |
| 715 | int nConflict; |
| 716 | int vid; |
| 717 | if( g.argc>4 ) usage("apply STASHID"); |
| 718 |
| --- src/stash.c | |
| +++ src/stash.c | |
| @@ -693,25 +693,38 @@ | |
| 693 | undo_save_stash(0); |
| 694 | stash_drop(stashid); |
| 695 | undo_finish(); |
| 696 | } |
| 697 | }else |
| 698 | if( memcmp(zCmd, "pop", nCmd)==0 || memcmp(zCmd, "apply", nCmd)==0 ){ |
| 699 | char *zCom = 0, *zDate = 0, *zHash = 0; |
| 700 | int popped = *zCmd=='p'; |
| 701 | if( popped ){ |
| 702 | if( g.argc>3 ) usage("pop"); |
| 703 | stashid = stash_get_id(0); |
| 704 | }else{ |
| 705 | if( g.argc>4 ) usage("apply STASHID"); |
| 706 | stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0); |
| 707 | } |
| 708 | zCom = db_text(0, "SELECT comment FROM stash WHERE stashid=%d", stashid); |
| 709 | zDate = db_text(0, "SELECT datetime(ctime) FROM stash WHERE stashid=%d", |
| 710 | stashid); |
| 711 | zHash = db_text(0, "SELECT hash FROM stash WHERE stashid=%d", stashid); |
| 712 | undo_begin(); |
| 713 | stash_apply(stashid, 0); |
| 714 | if( popped ) undo_save_stash(stashid); |
| 715 | fossil_print("%s stash:\n%5d: [%.14s] from %s\n", |
| 716 | popped ? "Popped" : "Applied", stashid, zHash, zDate); |
| 717 | if( zCom && *zCom ){ |
| 718 | fossil_print(" "); |
| 719 | comment_print(zCom, 0, 7, -1, get_comment_format()); |
| 720 | } |
| 721 | fossil_free(zCom); |
| 722 | fossil_free(zDate); |
| 723 | fossil_free(zHash); |
| 724 | undo_finish(); |
| 725 | if( popped ) stash_drop(stashid); |
| 726 | }else |
| 727 | if( memcmp(zCmd, "goto", nCmd)==0 ){ |
| 728 | int nConflict; |
| 729 | int vid; |
| 730 | if( g.argc>4 ) usage("apply STASHID"); |
| 731 |