(List (FunctionDef diff_mode [] (Com {[LIT_CHARS test]} {[DQ [VarSub TOOL_MODE]]} {[LIT_DBRACKET_LIKE "="]} {[LIT_CHARS diff]} ) ) (FunctionDef merge_mode [] (Com {[LIT_CHARS test]} {[DQ [VarSub TOOL_MODE]]} {[LIT_DBRACKET_LIKE "="]} {[LIT_CHARS merge]} ) ) (FunctionDef translate_merge_tool_path [] (Com {[LIT_CHARS echo]} {[DQ [VarSub 1]]} ) ) (FunctionDef check_unchanged [] (If (Com {[LIT_CHARS test]} {[DQ [VarSub MERGED]]} {[LIT_CHARS -nt]} {[DQ [VarSub BACKUP]]} ) (= scope= flags=0 words=[] bindings=[('status', {[LIT_CHARS 0]})]) (ElseTrue) (While (Com {[LIT_CHARS true]} ) (List (Com {[LIT_CHARS echo]} {[DQ [VarSub MERGED][LIT_CHARS " seems unchanged."]]} ) (Com {[LIT_CHARS printf]} {[DQ [LIT_CHARS "Was the merge successful? [y/n] "]]} ) (AndOr OP_OR_IF (Com {[LIT_CHARS read]} {[LIT_CHARS answer]} ) (Com {[LIT_CHARS return]} {[LIT_CHARS 1]} ) ) (Case to_match={[DQ [VarSub answer]]}, pat_word_list=[[{[LIT_CHARS y] [LIT_OTHER "*"]}, {[LIT_CHARS Y] [LIT_OTHER "*"]}], [{[LIT_CHARS n] [LIT_OTHER "*"]}, {[LIT_CHARS N] [LIT_OTHER "*"]}]] (List (= scope= flags=0 words=[] bindings=[('status', {[LIT_CHARS 0]})]) (Com {[LIT_CHARS break]} ) ) (List (= scope= flags=0 words=[] bindings=[('status', {[LIT_CHARS 1]})]) (Com {[LIT_CHARS break]} ) ) ) ) ) ) ) (FunctionDef valid_tool_config [] (If (Com {[LIT_CHARS test]} {[LIT_CHARS -n]} {[DQ [ComSub (Com {[LIT_CHARS get_merge_tool_cmd]} {[DQ [VarSub 1]]})]]} ) (Com {[LIT_CHARS return]} {[LIT_CHARS 0]} ) (ElseTrue) (Com {[LIT_CHARS return]} {[LIT_CHARS 1]} ) ) ) (FunctionDef valid_tool [] (AndOr OP_OR_IF (Com {[LIT_CHARS setup_tool]} {[DQ [VarSub 1]]} ) (Com {[LIT_CHARS valid_tool_config]} {[DQ [VarSub 1]]} ) ) ) (FunctionDef setup_tool [] (List (Case to_match={[DQ [VarSub 1]]}, pat_word_list=[[{[LIT_CHARS vim] [LIT_OTHER "*"]}, {[LIT_CHARS gvim] [LIT_OTHER "*"]}], [{[LIT_OTHER "*"]}]] (= scope= flags=0 words=[] bindings=[('tool', {[LIT_CHARS vim]})]) (= scope= flags=0 words=[] bindings=[('tool', {[DQ [VarSub 1]]})]) ) (= scope= flags=0 words=[] bindings=[('mergetools', {[DQ [ComSub (Com {[LIT_CHARS git]} {[LIT_CHARS --exec-path]})][LIT_CHARS /mergetools]]})]) (Com {[LIT_CHARS .]} {[DQ [VarSub mergetools][LIT_CHARS /defaults]]} ) (If (Pipeline! (Com {[LIT_CHARS test]} {[LIT_CHARS -f]} {[DQ [VarSub mergetools][LIT_CHARS /][VarSub tool]]} ) ) (Com {[LIT_CHARS return]} {[LIT_CHARS 1]} ) ) (Com {[LIT_CHARS .]} {[DQ [VarSub mergetools][LIT_CHARS /][VarSub tool]]} ) (If (AndOr OP_AND_IF (Com {[LIT_CHARS merge_mode]} ) (Pipeline! (Com {[LIT_CHARS can_merge]} ) ) ) (List (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "error: '"][VarSub tool][LIT_CHARS "' can not be used to resolve merges"]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) (AndOr OP_AND_IF (Com {[LIT_CHARS diff_mode]} ) (Pipeline! (Com {[LIT_CHARS can_diff]} ) ) ) (List (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "error: '"][VarSub tool][LIT_CHARS "' can only be used to resolve merges"]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) (Com {[LIT_CHARS return]} {[LIT_CHARS 0]} ) ) ) (FunctionDef get_merge_tool_cmd [] (List (= scope= flags=0 words=[] bindings=[('merge_tool', {[DQ [VarSub 1]]})]) (If (Com {[LIT_CHARS diff_mode]} ) (Com {[LIT_CHARS echo]} {[DQ [ComSub (AndOr OP_OR_IF (Com {[LIT_CHARS git]} {[LIT_CHARS config]} {[LIT_CHARS difftool.] [VarSub merge_tool] [LIT_CHARS .cmd]}) (Com {[LIT_CHARS git]} {[LIT_CHARS config]} {[LIT_CHARS mergetool.] [VarSub merge_tool] [LIT_CHARS .cmd]}) )]]} ) (ElseTrue) (Com {[LIT_CHARS echo]} {[DQ [ComSub (Com {[LIT_CHARS git]} {[LIT_CHARS config]} {[LIT_CHARS mergetool.] [VarSub merge_tool] [LIT_CHARS .cmd]})]]} ) ) ) ) (FunctionDef run_merge_tool [] (List (= scope= flags=0 words=[] bindings=[('GIT_PREFIX', {[VarSub GIT_PREFIX test_op=VS_TEST_COLON_HYPHEN {[LIT_CHARS .]}]})]) (= scope= flags=1 words=[{[LIT_CHARS GIT_PREFIX]}] bindings=[]) (AndOr OP_OR_IF (= scope= flags=0 words=[] bindings=[('merge_tool_path', {[DQ [ComSub (Com {[LIT_CHARS get_merge_tool_path]} {[DQ [VarSub 1]]})]]})]) (Com {[LIT_CHARS exit]} ) ) (= scope= flags=0 words=[] bindings=[('base_present', {[DQ [VarSub 2]]})]) (= scope= flags=0 words=[] bindings=[('status', {[LIT_CHARS 0]})]) (Com {[LIT_CHARS setup_tool]} {[DQ [VarSub 1]]} ) (If (Com {[LIT_CHARS merge_mode]} ) (Com {[LIT_CHARS merge_cmd]} {[DQ [VarSub 1]]} ) (ElseTrue) (Com {[LIT_CHARS diff_cmd]} {[DQ [VarSub 1]]} ) ) (Com {[LIT_CHARS return]} {[VarSub status]} ) ) ) (FunctionDef list_merge_tool_candidates [] (List (If (Com {[LIT_CHARS merge_mode]} ) (= scope= flags=0 words=[] bindings=[('tools', {[DQ [LIT_CHARS tortoisemerge]]})]) (ElseTrue) (= scope= flags=0 words=[] bindings=[('tools', {[DQ [LIT_CHARS kompare]]})]) ) (If (Com {[LIT_CHARS test]} {[LIT_CHARS -n]} {[DQ [VarSub DISPLAY]]} ) (List (If (Com {[LIT_CHARS test]} {[LIT_CHARS -n]} {[DQ [VarSub GNOME_DESKTOP_SESSION_ID]]} ) (= scope= flags=0 words=[] bindings=[('tools', {[DQ [LIT_CHARS "meld opendiff kdiff3 tkdiff xxdiff "][VarSub tools]]})]) (ElseTrue) (= scope= flags=0 words=[] bindings=[('tools', {[DQ [LIT_CHARS "opendiff kdiff3 tkdiff xxdiff meld "][VarSub tools]]})]) ) (= scope= flags=0 words=[] bindings=[('tools', {[DQ [VarSub tools][LIT_CHARS " gvimdiff diffuse ecmerge p4merge araxis bc3 codecompare"]]})]) ) ) (Case to_match={[DQ [VarSub VISUAL test_op=VS_TEST_COLON_HYPHEN {[VarSub EDITOR]}]]}, pat_word_list=[[{[LIT_OTHER "*"] [LIT_CHARS vim] [LIT_OTHER "*"]}], [{[LIT_OTHER "*"]}]] (= scope= flags=0 words=[] bindings=[('tools', {[DQ [VarSub tools][LIT_CHARS " vimdiff emerge"]]})]) (= scope= flags=0 words=[] bindings=[('tools', {[DQ [VarSub tools][LIT_CHARS " emerge vimdiff"]]})]) ) ) ) (FunctionDef guess_merge_tool [] (List (Com {[LIT_CHARS list_merge_tool_candidates]} ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "merge tool candidates: "][VarSub tools]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) (For i [{[VarSub tools]}]) (List (= scope= flags=0 words=[] bindings=[('merge_tool_path', {[DQ [ComSub (Com {[LIT_CHARS translate_merge_tool_path]} {[DQ [VarSub i]]})]]})]) (If (Com {[LIT_CHARS type]} {[DQ [VarSub merge_tool_path]]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), (DescriptorRedirectNode target={[LIT_CHARS 1]} &"> 2), > ) (List (Com {[LIT_CHARS echo]} {[DQ [VarSub i]]} ) (Com {[LIT_CHARS return]} {[LIT_CHARS 0]} ) ) ) ) ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "No known merge resolution program available."]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) (Com {[LIT_CHARS return]} {[LIT_CHARS 1]} ) ) ) (FunctionDef get_configured_merge_tool [] (List (If (Com {[LIT_CHARS diff_mode]} ) (= scope= flags=0 words=[] bindings=[('merge_tool', {[ComSub (AndOr OP_OR_IF (Com {[LIT_CHARS git]} {[LIT_CHARS config]} {[LIT_CHARS diff.tool]}) (Com {[LIT_CHARS git]} {[LIT_CHARS config]} {[LIT_CHARS merge.tool]}) )]})]) (ElseTrue) (= scope= flags=0 words=[] bindings=[('merge_tool', {[ComSub (Com {[LIT_CHARS git]} {[LIT_CHARS config]} {[LIT_CHARS merge.tool]})]})]) ) (If (AndOr OP_AND_IF (Com {[LIT_CHARS test]} {[LIT_CHARS -n]} {[DQ [VarSub merge_tool]]} ) (Pipeline! (Com {[LIT_CHARS valid_tool]} {[DQ [VarSub merge_tool]]} ) ) ) (List (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "git config option "][VarSub TOOL_MODE][LIT_CHARS ".tool set to unknown tool: "][VarSub merge_tool]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "Resetting to default..."]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) (Com {[LIT_CHARS return]} {[LIT_CHARS 1]} ) ) ) (Com {[LIT_CHARS echo]} {[DQ [VarSub merge_tool]]} ) ) ) (FunctionDef get_merge_tool_path [] (List (= scope= flags=0 words=[] bindings=[('merge_tool', {[DQ [VarSub 1]]})]) (If (Pipeline! (Com {[LIT_CHARS valid_tool]} {[DQ [VarSub merge_tool]]} ) ) (List (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "Unknown merge tool "][VarSub merge_tool]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) (If (Com {[LIT_CHARS diff_mode]} ) (= scope= flags=0 words=[] bindings=[('merge_tool_path', {[ComSub (AndOr OP_OR_IF (Com {[LIT_CHARS git]} {[LIT_CHARS config]} {[LIT_CHARS difftool.] [DQ [VarSub merge_tool]] [LIT_CHARS .path]}) (Com {[LIT_CHARS git]} {[LIT_CHARS config]} {[LIT_CHARS mergetool.] [DQ [VarSub merge_tool]] [LIT_CHARS .path]}) )]})]) (ElseTrue) (= scope= flags=0 words=[] bindings=[('merge_tool_path', {[ComSub (Com {[LIT_CHARS git]} {[LIT_CHARS config]} {[LIT_CHARS mergetool.] [DQ [VarSub merge_tool]] [LIT_CHARS .path]})]})]) ) (If (Com {[LIT_CHARS test]} {[LIT_CHARS -z]} {[DQ [VarSub merge_tool_path]]} ) (= scope= flags=0 words=[] bindings=[('merge_tool_path', {[DQ [ComSub (Com {[LIT_CHARS translate_merge_tool_path]} {[DQ [VarSub merge_tool]]})]]})]) ) (If (AndOr OP_AND_IF (Com {[LIT_CHARS test]} {[LIT_CHARS -z]} {[DQ [ComSub (Com {[LIT_CHARS get_merge_tool_cmd]} {[DQ [VarSub merge_tool]]})]]} ) (Pipeline! (Com {[LIT_CHARS type]} {[DQ [VarSub merge_tool_path]]} < (FilenameRedirectNode filename={[LIT_CHARS /dev/null]} "> 1), (DescriptorRedirectNode target={[LIT_CHARS 1]} &"> 2), > ) ) ) (List (Com {[LIT_CHARS echo]} {[DQ [LIT_CHARS "The "][VarSub TOOL_MODE][LIT_CHARS " tool "][VarSub merge_tool][LIT_CHARS " is not available as"]]} {[DQ [LIT_CHARS "'"][VarSub merge_tool_path][LIT_CHARS "'"]]} < (DescriptorRedirectNode target={[LIT_CHARS 2]} &"> 1), > ) (Com {[LIT_CHARS exit]} {[LIT_CHARS 1]} ) ) ) (Com {[LIT_CHARS echo]} {[DQ [VarSub merge_tool_path]]} ) ) ) (FunctionDef get_merge_tool [] (List (= scope= flags=0 words=[] bindings=[('merge_tool', {[DQ [ComSub (Com {[LIT_CHARS get_configured_merge_tool]})]]})]) (If (Com {[LIT_CHARS test]} {[LIT_CHARS -z]} {[DQ [VarSub merge_tool]]} ) (AndOr OP_OR_IF (= scope= flags=0 words=[] bindings=[('merge_tool', {[DQ [ComSub (Com {[LIT_CHARS guess_merge_tool]})]]})]) (Com {[LIT_CHARS exit]} ) ) ) (Com {[LIT_CHARS echo]} {[DQ [VarSub merge_tool]]} ) ) ) )