(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:USAGE) op: Equal rhs: {(DQ ('[-a] [-r] [-m] [-t] [-n] [-b <newname>] <name>'))} spids: [4] ) ] spids: [4] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LONG_USAGE) op: Equal rhs: { (DQ ('git-resurrect attempts to find traces of a branch tip\n') ('called <name>, and tries to resurrect it. Currently, the reflog is\n') ('searched for checkout messages, and with -r also merge messages. With\n') ('-m and -t, the history of all refs is scanned for Merge <name> into\n') ('other/Merge <other> into <name> (respectively) commit subjects, which\n') ("is rather slow but allows you to resurrect other people's topic\n") (branches.) ) } spids: [9] ) ] spids: [9] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:OPTIONS_KEEPDASHDASH) op:Equal rhs:{(SQ )} spids:[21])] spids: [21] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:OPTIONS_STUCKLONG) op:Equal rhs:{(SQ )} spids:[23])] spids: [23] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:OPTIONS_SPEC) op: Equal rhs: { (DQ ('git resurrect ') ($ VSub_Name '$USAGE') ('\n') ('--\n') ('b,branch= save branch as <newname> instead of <name>\n') ('a,all same as -l -r -m -t\n') ('k,keep-going full rev-list scan (instead of first match)\n') ('l,reflog scan reflog for checkouts (enabled by default)\n') ('r,reflog-merges scan for merges recorded in reflog\n') ('m,merges scan for merges into other branches (slow)\n') ('t,merge-targets scan for merges of other branches into <name>\n') ("n,dry-run don't recreate the branch") ) } spids: [25] ) ] spids: [25] ) (C {(.)} {(git-sh-setup)}) (FuncDef name: search_reflog body: (BraceGroup children: [ (SimpleCommand words: [ {(sed)} {(-ne)} {(SQ <'s~^\\([^ ]*\\) .*\\tcheckout: moving from '>) (DQ ($ VSub_Number '$1')) (SQ <' .*~\\1~p'>) } ] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {(DQ ($ VSub_Name '$GIT_DIR')) (/logs/HEAD)} spids: [72] ) ] ) ] spids: [53] ) spids: [48 52] ) (FuncDef name: search_reflog_merges body: (BraceGroup children: [ (C {(git)} {(rev-parse)} { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(sed)} {(-ne)} {(SQ <'s~^[^ ]* \\([^ ]*\\) .*\\tmerge '>) (DQ ($ VSub_Number '$1')) (SQ <':.*~\\1^2~p'>) } ] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {(DQ ($ VSub_Name '$GIT_DIR')) (/logs/HEAD)} spids: [113] ) ] ) ] ) left_token: <Left_CommandSub '$('> spids: [94 121] ) } ) ] spids: [87] ) spids: [82 86] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_x40) op: Equal rhs: {(DQ ('[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'))} spids: [126] ) ] spids: [126] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_x40) op: Equal rhs: { (DQ ($ VSub_Name '$_x40') ($ VSub_Name '$_x40') ($ VSub_Name '$_x40') ($ VSub_Name '$_x40') ($ VSub_Name '$_x40') ($ VSub_Name '$_x40') ($ VSub_Name '$_x40') ($ VSub_Name '$_x40') ) } spids: [131] ) ] spids: [131] ) (FuncDef name: search_merges body: (BraceGroup children: [ (Pipeline children: [ (C {(git)} {(rev-list)} {(--all)} {(--grep) (Lit_Other '=') (DQ ("Merge branch '") ($ VSub_Number '$1') ("'"))} {(--pretty) (Lit_Other '=') (tformat) (Lit_Other ':') (DQ ('%P %s'))} ) (C {(sed)} {(-ne)} { (DQ ('/^') ($ VSub_Name '$_x40') (' ') (EscapedLiteralPart token:<Lit_EscapedChar '\\('>) ($ VSub_Name '$_x40') (EscapedLiteralPart token:<Lit_EscapedChar '\\)'>) (' Merge .*/ {s//') (EscapedLiteralPart token:<Lit_EscapedChar '\\1'>) ('/p;') ($ VSub_Name '$early_exit') ('}') ) } ) ] negated: False ) ] spids: [149] ) spids: [144 148] ) (FuncDef name: search_merge_targets body: (BraceGroup children: [ (Pipeline children: [ (C {(git)} {(rev-list)} {(--all)} {(--grep) (Lit_Other '=') (DQ ("Merge branch '[^']*' into ") ($ VSub_Name '$branch') (EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) ) } {(--pretty) (Lit_Other '=') (tformat) (Lit_Other ':') (DQ ('%H %s'))} {(--all)} ) (C {(sed)} {(-ne)} { (DQ ('/^') (EscapedLiteralPart token:<Lit_EscapedChar '\\('>) ($ VSub_Name '$_x40') (EscapedLiteralPart token:<Lit_EscapedChar '\\)'>) (' Merge .*/ {s//') (EscapedLiteralPart token:<Lit_EscapedChar '\\1'>) ('/p;') ($ VSub_Name '$early_exit') ('} ') ) } ) ] negated: False ) ] spids: [205] ) spids: [200 204] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:dry_run) op:Equal rhs:{(SQ )} spids:[256])] spids: [256] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:early_exit) op:Equal rhs:{(q)} spids:[258])] spids: [258] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:scan_reflog) op:Equal rhs:{(t)} spids:[261])] spids: [261] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:scan_reflog_merges) op:Equal rhs:{(SQ )} spids:[264])] spids: [264] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:scan_merges) op:Equal rhs:{(SQ )} spids:[266])] spids: [266] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:scan_merge_targets) op:Equal rhs:{(SQ )} spids:[268])] spids: [268] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:new_name) op:Equal rhs:{(SQ )} spids:[270])] spids: [270] ) (While cond: [ (Sentence child: (C {(test)} {(DQ ($ VSub_Pound '$#'))} {(KW_Bang '!') (Lit_Other '=')} {(0)}) terminator: <Op_Semi ';'> ) ] body: (DoGroup children: [ (Case to_match: {(DQ ($ VSub_Number '$1'))} arms: [ (case_arm pat_list: [{(-b)} {(--branch)}] action: [ (C {(shift)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:new_name) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [308] ) ] spids: [308] ) ] spids: [299 302 314 -1] ) (case_arm pat_list: [{(-n)} {(--dry-run)}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:dry_run) op:Equal rhs:{(t)} spids:[323])] spids: [323] ) ] spids: [317 320 327 -1] ) (case_arm pat_list: [{(--no-dry-run)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dry_run) op: Equal rhs: {(SQ )} spids: [334] ) ] spids: [334] ) ] spids: [330 331 337 -1] ) (case_arm pat_list: [{(-k)} {(--keep-going)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:early_exit) op: Equal rhs: {(SQ )} spids: [346] ) ] spids: [346] ) ] spids: [340 343 349 -1] ) (case_arm pat_list: [{(--no-keep-going)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:early_exit) op: Equal rhs: {(q)} spids: [356] ) ] spids: [356] ) ] spids: [352 353 360 -1] ) (case_arm pat_list: [{(-m)} {(--merges)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:scan_merges) op: Equal rhs: {(t)} spids: [369] ) ] spids: [369] ) ] spids: [363 366 373 -1] ) (case_arm pat_list: [{(--no-merges)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:scan_merges) op: Equal rhs: {(SQ )} spids: [380] ) ] spids: [380] ) ] spids: [376 377 383 -1] ) (case_arm pat_list: [{(-l)} {(--reflog)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:scan_reflog) op: Equal rhs: {(t)} spids: [392] ) ] spids: [392] ) ] spids: [386 389 396 -1] ) (case_arm pat_list: [{(--no-reflog)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:scan_reflog) op: Equal rhs: {(SQ )} spids: [403] ) ] spids: [403] ) ] spids: [399 400 406 -1] ) (case_arm pat_list: [{(-r)} {(--reflog_merges)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:scan_reflog_merges) op: Equal rhs: {(t)} spids: [415] ) ] spids: [415] ) ] spids: [409 412 419 -1] ) (case_arm pat_list: [{(--no-reflog_merges)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:scan_reflog_merges) op: Equal rhs: {(SQ )} spids: [426] ) ] spids: [426] ) ] spids: [422 423 429 -1] ) (case_arm pat_list: [{(-t)} {(--merge-targets)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:scan_merge_targets) op: Equal rhs: {(t)} spids: [438] ) ] spids: [438] ) ] spids: [432 435 442 -1] ) (case_arm pat_list: [{(--no-merge-targets)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:scan_merge_targets) op: Equal rhs: {(SQ )} spids: [449] ) ] spids: [449] ) ] spids: [445 446 452 -1] ) (case_arm pat_list: [{(-a)} {(--all)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:scan_reflog) op: Equal rhs: {(t)} spids: [461] ) ] spids: [461] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:scan_reflog_merges) op: Equal rhs: {(t)} spids: [465] ) ] spids: [465] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:scan_merges) op: Equal rhs: {(t)} spids: [469] ) ] spids: [469] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:scan_merge_targets) op: Equal rhs: {(t)} spids: [473] ) ] spids: [473] ) ] spids: [455 458 477 -1] ) (case_arm pat_list: [{(--)}] action: [(C {(shift)}) (ControlFlow token:<ControlFlow_Break break>)] spids: [480 481 490 -1] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [(C {(usage)})] spids: [493 494 500 -1] ) ] spids: [290 296 503] ) (C {(shift)}) ] spids: [287 508] ) ) (AndOr children: [(C {(test)} {(DQ ($ VSub_Pound '$#'))} {(Lit_Other '=')} {(1)}) (C {(usage)})] op_id: Op_DPipe ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:all_strategies) op: Equal rhs: { (DQ ($ VSub_Name '$scan_reflog') ($ VSub_Name '$scan_reflog_merges') ($ VSub_Name '$scan_merges') ($ VSub_Name '$scan_merge_targets') ) } spids: [526] ) ] spids: [526] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {(-z)} {(DQ ($ VSub_Name '$all_strategies'))}) terminator: <Op_Semi ';'> ) ] action: [(C {(die)} {(DQ ('must enable at least one of -lrmt'))})] spids: [-1 545] ) ] spids: [-1 554] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:branch) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [557] ) ] spids: [557] ) (AndOr children: [ (C {(test)} {(-z)} {(DQ ($ VSub_Name '$new_name'))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:new_name) op: Equal rhs: {(DQ ($ VSub_Name '$branch'))} spids: [572] ) ] spids: [572] ) ] op_id: Op_DAmp ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {(KW_Bang '!')} {(-z)} {(DQ ($ VSub_Name '$scan_reflog'))}) terminator: <Op_Semi ';'> ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {(-r)} {(DQ ($ VSub_Name '$GIT_DIR')) (/logs/HEAD)}) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:candidates) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(search_reflog)} {($ VSub_Name '$branch')})] ) left_token: <Left_CommandSub '$('> spids: [611 615] ) ) } spids: [609] ) ] spids: [609] ) ] spids: [-1 606] ) ] else_action: [ (C {(die)} {(SQ <'reflog scanning requested, but'>)} {(SQ <'$GIT_DIR/logs/HEAD not readable'>)} ) ] spids: [619 635] ) ] spids: [-1 591] ) ] spids: [-1 637] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {(KW_Bang '!')} {(-z)} {(DQ ($ VSub_Name '$scan_reflog_merges'))}) terminator: <Op_Semi ';'> ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {(-r)} {(DQ ($ VSub_Name '$GIT_DIR')) (/logs/HEAD)}) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:candidates) op: Equal rhs: { (DQ ($ VSub_Name '$candidates') (' ') (CommandSubPart command_list: (CommandList children: [(C {(search_reflog_merges)} {($ VSub_Name '$branch')})] ) left_token: <Left_CommandSub '$('> spids: [674 678] ) ) } spids: [670] ) ] spids: [670] ) ] spids: [-1 667] ) ] else_action: [ (C {(die)} {(SQ <'reflog scanning requested, but'>)} {(SQ <'$GIT_DIR/logs/HEAD not readable'>)} ) ] spids: [682 698] ) ] spids: [-1 652] ) ] spids: [-1 700] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {(KW_Bang '!')} {(-z)} {(DQ ($ VSub_Name '$scan_merges'))}) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:candidates) op: Equal rhs: { (DQ ($ VSub_Name '$candidates') (' ') (CommandSubPart command_list: (CommandList children: [(C {(search_merges)} {($ VSub_Name '$branch')})] ) left_token: <Left_CommandSub '$('> spids: [722 726] ) ) } spids: [718] ) ] spids: [718] ) ] spids: [-1 715] ) ] spids: [-1 729] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {(KW_Bang '!')} {(-z)} {(DQ ($ VSub_Name '$scan_merge_targets'))}) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:candidates) op: Equal rhs: { (DQ ($ VSub_Name '$candidates') (' ') (CommandSubPart command_list: (CommandList children: [(C {(search_merge_targets)} {($ VSub_Name '$branch')})] ) left_token: <Left_CommandSub '$('> spids: [751 755] ) ) } spids: [747] ) ] spids: [747] ) ] spids: [-1 744] ) ] spids: [-1 758] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:candidates) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(git)} {(rev-parse)} {($ VSub_Name '$candidates')}) (C {(sort)} {(-u)}) ] negated: False ) ] ) left_token: <Left_CommandSub '$('> spids: [763 775] ) ) } spids: [761] ) ] spids: [761] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {(-z)} {(DQ ($ VSub_Name '$candidates'))}) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:hint) op:Equal rhs:{(SQ )} spids:[793])] spids: [793] ) (AndOr children: [ (C {(test)} {(DQ (z) ($ VSub_Name '$all_strategies'))} {(KW_Bang '!') (Lit_Other '=')} {(DQ (ztttt))} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:hint) op: Equal rhs: {(DQ (' (maybe try again with -a)'))} spids: [814] ) ] spids: [814] ) ] op_id: Op_DAmp ) (C {(die)} {(DQ ('no candidates for ') ($ VSub_Name '$branch') (' found') ($ VSub_Name '$hint'))} ) ] spids: [-1 790] ) ] spids: [-1 829] ) (C {(echo)} {(DQ ('** Candidates for ') ($ VSub_Name '$branch') (' **'))}) (Pipeline children: [ (ForEach iter_name: cmt iter_words: [{($ VSub_Name '$candidates')}] do_arg_iter: False body: (DoGroup children: [ (C {(git)} {(--no-pager)} {(log)} {(--pretty) (Lit_Other '=') (tformat) (Lit_Other ':') (DQ ('%ct:%h [%cr] %s'))} {(--abbrev-commit)} {(-1)} {($ VSub_Name '$cmt')} ) ] spids: [849 872] ) spids: [845 847] ) (C {(sort)} {(-n)}) (C {(cut)} {(-d) (Lit_Other ':')} {(-f2-)}) ] negated: False ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:newest) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(git)} {(rev-list)} {(-1)} {($ VSub_Name '$candidates')})] ) left_token: <Left_CommandSub '$('> spids: [893 901] ) ) } spids: [891] ) ] spids: [891] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {(KW_Bang '!')} {(-z)} {(DQ ($ VSub_Name '$dry_run'))}) terminator: <Op_Semi ';'> ) ] action: [ (C {(printf)} {(DQ ('** Most recent: '))}) (C {(git)} {(--no-pager)} {(log)} {(-1)} {(--pretty) (Lit_Other '=') (tformat) (Lit_Other ':') (DQ ('%h %s'))} {($ VSub_Name '$newest')} ) ] spids: [-1 917] ) (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [{(git)} {(rev-parse)} {(--verify)} {(--quiet)} {($ VSub_Name '$new_name')}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[959])] ) ] negated: True ) terminator: <Op_Semi ';'> ) ] action: [ (C {(printf)} {(DQ ('** Restoring ') ($ VSub_Name '$new_name') (' to '))}) (C {(git)} {(--no-pager)} {(log)} {(-1)} {(--pretty) (Lit_Other '=') (tformat) (Lit_Other ':') (DQ ('%h %s'))} {($ VSub_Name '$newest')} ) (C {(git)} {(branch)} {($ VSub_Name '$new_name')} {($ VSub_Name '$newest')}) ] spids: [945 963] ) ] else_action: [ (C {(printf)} {(DQ ('Most recent: '))}) (C {(git)} {(--no-pager)} {(log)} {(-1)} {(--pretty) (Lit_Other '=') (tformat) (Lit_Other ':') (DQ ('%h %s'))} {($ VSub_Name '$newest')} ) (C {(echo)} {(DQ ('** ') ($ VSub_Name '$new_name') (' already exists, doing nothing'))}) ] spids: [1002 1039] ) ] )