From ddfea0cf5e0a60b028bf423a29452afbce3c61e9 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Wed, 14 Jan 2009 13:09:50 -0600 Subject: [PATCH 1/4] Add git-tool.remote --- extra/git-tool/remote/remote.factor | 392 ++++++++++++++++++++++++++++ 1 file changed, 392 insertions(+) create mode 100644 extra/git-tool/remote/remote.factor diff --git a/extra/git-tool/remote/remote.factor b/extra/git-tool/remote/remote.factor new file mode 100644 index 0000000000..e5291a8459 --- /dev/null +++ b/extra/git-tool/remote/remote.factor @@ -0,0 +1,392 @@ + +USING: accessors calendar git-tool git-tool io.directories +io.monitors io.pathnames kernel locals math namespaces +sequences splitting system threads ui ui.gadgets +ui.gadgets.buttons ui.gadgets.labels ui.gadgets.packs ; + +USING: git-tool ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +IN: git-tool.remote + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +TUPLE: < pack + repository + branch + remote + remote-branch + fetch-period + push + closed + last-refresh ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: current-branch ( REPO -- branch ) + { "git" "branch" } git-process stdout>> [ "* " head? ] find nip 2 tail ; + +: list-branches ( REPO -- branches ) + { "git" "branch" } git-process stdout>> + [ empty? not ] filter + [ 2 tail ] map ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: list-remotes ( REPO -- remotes ) + { "git" "remote" } git-process stdout>> [ empty? not ] filter ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +:: list-remote-branches ( REPO REMOTE -- branches ) + [let | OUT [ REPO { "git" "remote" "show" REMOTE } git-process stdout>> ] | + + " Tracked remote branches" OUT member? + [ + OUT + " Tracked remote branches" OUT index 1 + tail first " " split + [ empty? not ] filter + ] + [ + OUT + OUT [ " New remote branches" head? ] find drop + 1 + tail first " " split + [ empty? not ] filter + ] + if ] ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +:: refresh-git-remote-gadget ( GADGET -- ) + + [let | REPO [ GADGET repository>> ] | + + GADGET clear-gadget + + GADGET + + ! Repository label + + "Repository: " REPO [ current-directory get ] with-directory append +