{"thread":{"id":"15266","subject":"[PATCH 0/3] git-svn-externals PoC (in a sh script)","startedAt":"2008-08-29T00:02:12Z","lastAt":"2008-09-10T13:59:18Z","messageCount":9,"participants":["Eddy Petrișor","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"89053","messageId":"60381eeb0808281702q3dc7543enff2b35ebbcc80d08@mail.gmail.com","threadId":"15266","inReplyTo":null,"subject":"[PATCH 0/3] git-svn-externals PoC (in a sh script)","fromName":"Eddy Petrișor","fromEmail":"eddy.petrisor@gmail.com","sentAt":"2008-08-29T00:02:12Z","receivedAt":"2008-08-29T00:02:12Z","isPatch":true,"sender":{"key":"eddy.petrisor@gmail.com","avatar":"https://gravatar.com/avatar/e13eef6cecbe95604b4667c7bddf5aee2bb4af684c5fdceaf9e2aebfead3e9f5?d=mp&s=160"},"body":"Hello,\n\nI have started a while back working on support for svn:externals\nsupport for git-svn, but since I'm not that satisfied with the current\nstatus of the patch, I haven't modified git-svn itself and just left\nthe sh script I made as a PoC as it was.\n\nThere's still work to be done to it, but I the current version is\nfunctional enough to be probably found useful by more people than\nmyself.\n\n\nCurrent status follows:\n\n    Current functionality:\n     - fetches all the externals of an already svn-fetched repo\n     - support for svn:externals refresh\n     - if the location of the external has changed, the current working\n       copy will be placed aside and a new directory will be created\n       instead\n     - if the remote URI is the same (maybe a verison bump, there will\n       be a 'git svn rebase'\n     - remove support (useful for testing purposes or clean restarts)\n     - avoid zombie externals at all costs - in some repos empty\n       svn:externals might exist; svn ignores such externals, so git should\n       do the same\n\n    TODO:\n     - take into account the revision of an external, if it exists\n     - do not do deep svn cloning, to avoid legthy operations, just pull HEAD\n       (this actually needs changes in git-svn itself)\n     - use/create shallow copies to git svn repos (one revision should be enough\n       for most externals)\n     - use submodules for externals\n\n\n\n\nAny comments are welcome.\n\n\n-- \nRegards,\nEddyP\n=============================================\n\"Imagination is more important than knowledge\" A.Einstein\n"},{"id":"89054","messageId":"1219968179-14156-1-git-send-email-eddy.petrisor@gmail.com","threadId":"15266","inReplyTo":"60381eeb0808281702q3dc7543enff2b35ebbcc80d08@mail.gmail.com","subject":"[PATCH] git svn: should not display zombie externals","fromName":"Eddy Petrișor","fromEmail":"eddy.petrisor@gmail.com","sentAt":"2008-08-29T00:02:57Z","receivedAt":"2008-08-29T00:02:57Z","isPatch":true,"sender":{"key":"eddy.petrisor@gmail.com","avatar":"https://gravatar.com/avatar/e13eef6cecbe95604b4667c7bddf5aee2bb4af684c5fdceaf9e2aebfead3e9f5?d=mp&s=160"},"body":"subversion does not process in any way empty svn:externals properties\nand doesn't list them in any way; git svn externals shouldn't do that\neither\n\nSigned-off-by: Eddy Petrișor <eddy.petrisor@gmail.com>\n---\n t/t9101-git-svn-props.sh |   24 +++++++++++++++++++++++-\n 1 files changed, 23 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh\nindex f420796..e174b30 100755\n--- a/t/t9101-git-svn-props.sh\n+++ b/t/t9101-git-svn-props.sh\n@@ -211,7 +211,29 @@ EOF\n \n test_expect_success 'test proplist' \"\n \tgit-svn proplist . | cmp - prop.expect &&\n-\tgit-svn proplist nested/directory/.keep | cmp - prop2.expect\n+\tgit-svn proplist nested/directory/.keep | cmp - prop2.expect &&\n+\tcd ..\n+\t\"\n+\n+test_expect_success 'show external' \"\n+\tcd test_wc &&\n+\t\tsvn mkdir zombie &&\n+\t\tsvn propset svn:externals 'externaldir file:///fake/external' zombie &&\n+\t\tsvn ci -m 'added a fake svn:external' &&\n+\tcd .. &&\n+\tgit-svn fetch &&\n+\tgit-merge git-svn &&\n+\tgit-svn show-externals | grep -q 'externaldir'\n+\t\"\n+\n+test_expect_failure 'remove external' \"\n+\tcd test_wc &&\n+\t\tsvn propset svn:externals '' zombie &&\n+\t\tsvn ci -m 'deleted the fake external' &&\n+\tcd .. &&\n+\tgit-svn fetch &&\n+\tgit-merge git-svn &&\n+\tgit-svn show-externals | grep -v ^# | grep -v ^$ | grep -q -v '^/zombie'\n \t\"\n \n test_done\n-- \n1.5.6.3\n"},{"id":"89056","messageId":"1219968179-14156-2-git-send-email-eddy.petrisor@gmail.com","threadId":"15266","inReplyTo":"1219968179-14156-1-git-send-email-eddy.petrisor@gmail.com","subject":"[PATCH] First crude implementation of git-svn-externals","fromName":"Eddy Petrișor","fromEmail":"eddy.petrisor@gmail.com","sentAt":"2008-08-29T00:02:58Z","receivedAt":"2008-08-29T00:02:58Z","isPatch":true,"sender":{"key":"eddy.petrisor@gmail.com","avatar":"https://gravatar.com/avatar/e13eef6cecbe95604b4667c7bddf5aee2bb4af684c5fdceaf9e2aebfead3e9f5?d=mp&s=160"},"body":"From: Eddy Petrisor <eddy@epetrisor.dsd.ro>\n\nCurrent functionality:\n - fetches all the externals of an already svn-fetched repo\n - support for svn:externals refresh\n - if the location of the external has changed, the current working\n   copy will be placed aside and a new directory will be created\n   instead\n - if the remote URI is the same (maybe a verison bump, there will\n   be a 'git svn rebase'\n - remove support (useful for testing purposes or clean restarts)\n - avoid zombie externals at all costs - in some repos empty\n   svn:externals might exist; svn ignores such externals, so git should\n   do the same\n\nTODO:\n - take into account the revision of an external, if it exists\n - do not do deep svn cloning, to avoid legthy operations, just pull HEAD\n - add shallow copies to git svn repos (one revision should be enough\n   for most externals)\n - use submodules for externals\n---\n .gitignore           |    1 +\n Makefile             |    1 +\n git-svn-externals.sh |  158 ++++++++++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 160 insertions(+), 0 deletions(-)\n create mode 100755 git-svn-externals.sh\n\ndiff --git a/.gitignore b/.gitignore\nindex bbaf9de..cd2c47d 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -123,6 +123,7 @@ git-status\n git-stripspace\n git-submodule\n git-svn\n+git-svn-externals\n git-symbolic-ref\n git-tag\n git-tar-tree\ndiff --git a/Makefile b/Makefile\nindex bf400e6..b130244 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -265,6 +265,7 @@ SCRIPT_SH += git-sh-setup.sh\n SCRIPT_SH += git-stash.sh\n SCRIPT_SH += git-submodule.sh\n SCRIPT_SH += git-web--browse.sh\n+SCRIPT_SH += git-svn-externals.sh\n \n SCRIPT_PERL += git-add--interactive.perl\n SCRIPT_PERL += git-archimport.perl\ndiff --git a/git-svn-externals.sh b/git-svn-externals.sh\nnew file mode 100755\nindex 0000000..38b7af6\n--- /dev/null\n+++ b/git-svn-externals.sh\n@@ -0,0 +1,158 @@\n+#!/bin/sh\n+\n+set -e\n+\n+GIT_SVN_LAST_DIR=\"$(pwd)\"\n+trap \"cd '$GIT_SVN_LAST_DIR'\" INT EXIT KILL\n+\n+\n+USAGE='[help|init|refresh|show]'\n+\n+LONG_USAGE='git svn externals help\n+\tprint this long help message.\n+git svn externals init [<pathspec>...]\n+\tpull all externals according to current repo state.\n+git svn externals refresh [<pathspec>...]\n+\tremoves current externals and repulls them.\n+'\n+\n+\n+SUBDIRECTORY_OK=Sometimes\n+OPTIONS_SPEC=\n+. git-sh-setup\n+cd_to_toplevel\n+# this should never fail\n+require_work_tree\n+\n+\n+GIT_SVN_TOP_DIR=\"$(pwd)\"\n+\n+svn_revision_to_numrevision ()\n+#$1 - repository URI\n+#$2 - the revision to be transformed\n+{\n+\tlocal REVSPEC\n+\t[ \"$2\" ] && REVSPEC=\"-r $2\" || REVSPEC=''\n+\t[ \"$1\" ] || die \"Internal error: no repository given in svn_revision_to_numrevision\"\n+\tLANG=C svn info \"$1\" \"$REVSPEC\" | grep 'Revision' | cut -f 2 -d ':' | sed 's#^\\ \\ *##g'\n+}\n+\n+prune_inital_slashes ()\n+{\n+\techo \"$1\" | sed 's#^//*##g'\n+}\n+\n+git_svn_externals_remove ()\n+{\n+\tlocal LASTDIR=\"$(pwd)\"\n+\tcd_to_toplevel && TOPLEVELDIR=\"$(pwd)\"\n+\tgit svn show-externals | grep -vE '^(#.*|)$' | while read EXT_DIR REV EXT_SRC ; do\n+\t\tif [ -z \"$REV\" ] ; then\n+\t\t\techo \"Skipping illegal external '$EXT_DIR' which has no value\" >&2\n+\t\t\tcontinue\n+\t\tfi\n+\t\tEXT_DIR=\"$(prune_inital_slashes \"$EXT_DIR\")\"\n+\n+\t\tif [ -z \"$EXT_SRC\" ] ; then\n+\t\t\tEXT_SRC=\"$REV\"\n+\t\t\tREV=\"-rHEAD\"\n+\t\tfi\n+\t\tREV=${REV#-r}\n+\n+\t\techo \"Removing local copy for external '$EXT_DIR' ( $EXT_SRC@$REV )\"\n+\t\trm -fr \"$EXT_DIR\"\n+\tdone\n+\n+\tcd \"$LASTDIR\"\n+}\n+\n+git_svn_init_dir_repo ()\n+# assumes is ran from the parent dir of the repo\n+# $1 EXT_DIR\n+# $2 EXT_SRC\n+# $3 REV\n+{\n+\tlocal LASTDIR=\"$(pwd)\"\n+\n+\tmkdir -p \"$1\"\n+\tcd \"$1\"\n+\tgit svn init \"$2\"\n+\tgit svn fetch\n+\n+\tcd \"$LASTDIR\"\n+}\n+\n+git_svn_externals_refresh_external ()\n+#$1 directory where the external is locally\n+#$2 remote url\n+#$3 revision at which the external is pinned at\n+{\n+\tlocal LASTDIR=\"$GIT_SVN_TOP_DIR\"\n+\n+\tlocal EXT_SRC=\"$2\"\n+\tlocal EXT_DIR=\"$1\"\n+\n+\tif cd \"$EXT_DIR\" 2>/dev/null; then\n+\t\tlocal OLDDIREXISTS=yes\n+\t\tlocal OLD_EXT_SRC=$(git config --get svn-remote.svn.url)\n+\t\tlocal OLD_EXT_REV=$(git config --get svn-remote.svn.revision || svn_revision_to_numrevision $OLD_EXT_SRC HEAD)\n+\t\tcd -\n+\telse\n+\t\tlocal OLDDIREXISTS=no\n+\t\tlocal OLD_EXT_SRC=\"${EXT_SRC}\"\n+\t\tlocal OLD_EXT_REV=$(svn_revision_to_numrevision $EXT_SRC HEAD)\n+\tfi\n+\n+\tif [ \"$OLD_EXT_SRC\" != \"$EXT_SRC\" ] ; then\n+\t\techo \"External URI definition changed. Moving away the old repo and pulling a new one.\"\n+\t\tcd \"$LASTDIR\"\n+\t\tlocal SUBDIR=\"$(basename \"$EXT_DIR\")\"\n+\t\tlocal DIRNAME=\"$(dirname \"$EXT_DIR\")\"\n+\t\tNEWDIR=\"$(mktemp -p \"$DIRNAME\" \"$SUBDIR.obsolete.XXXXXX\")\" && rm -f \"$NEWDIR\"\n+\t\tmv \"$EXT_DIR\" \"$NEWDIR\"\n+\t\techo \"  Old copy moved to '$NEWDIR'.\"\n+\t\tgit_svn_init_dir_repo \"$EXT_DIR\" \"$EXT_SRC\" \"$REV\"\n+\telif [ \"$OLDDIREXISTS\" = \"no\" ] ; then\n+\t\tgit_svn_init_dir_repo \"$EXT_DIR\" \"$EXT_SRC\" \"$REV\"\n+\telse\n+\t\tcd \"$EXT_DIR\"\n+\t\tgit svn rebase\n+\tfi\n+\n+\tcd \"$LASTDIR\"\n+\treturn 0\n+}\n+\n+git_svn_externals_refresh ()\n+{\n+\tgit svn show-externals | grep -vE '^(#.*|)$' | while read EXT_DIR REV EXT_SRC ; do\n+\t\tif [ -z \"$REV\" ] ; then\n+\t\t\techo \"Skipping illegal external '$EXT_DIR' which has no value\" >&2\n+\t\t\tcontinue\n+\t\tfi\n+\t\tEXT_DIR=\"$(prune_inital_slashes \"$EXT_DIR\")\"\n+\n+\t\tif [ -z \"$EXT_SRC\" ] ; then\n+\t\t\tEXT_SRC=\"$REV\"\n+\t\t\tREV=\"-rHEAD\"\n+\t\tfi\n+\t\tREV=${REV#-r}\n+\n+\t\techo \"Refreshing local copy for external '$EXT_DIR' ( $EXT_SRC@$REV )\"\n+\t\tcd \"$GIT_SVN_TOP_DIR\"\n+\t\tgit_svn_externals_refresh_external \"$EXT_DIR\" \"$EXT_SRC\" \"$REV\"\n+\tdone\n+\n+\tcd \"$GIT_SVN_TOP_DIR\"\n+}\n+\n+\n+case $1 in\n+\t--remove)\n+\t\tgit_svn_externals_remove\n+\t\t;;\n+\t-r|--refresh|*)\n+\t\tgit_svn_externals_refresh\n+\t\t;;\n+esac\n+\n-- \n1.5.6.3\n"},{"id":"89055","messageId":"1219968179-14156-3-git-send-email-eddy.petrisor@gmail.com","threadId":"15266","inReplyTo":"1219968179-14156-2-git-send-email-eddy.petrisor@gmail.com","subject":"[PATCH] added a test frame for git-svn-externals.sh","fromName":"Eddy Petrișor","fromEmail":"eddy.petrisor@gmail.com","sentAt":"2008-08-29T00:02:59Z","receivedAt":"2008-08-29T00:02:59Z","isPatch":true,"sender":{"key":"eddy.petrisor@gmail.com","avatar":"https://gravatar.com/avatar/e13eef6cecbe95604b4667c7bddf5aee2bb4af684c5fdceaf9e2aebfead3e9f5?d=mp&s=160"},"body":"From: Eddy Petrisor <eddy@epetrisor.dsd.ro>\n\n---\n t/t9130-git-svn-externals-fetch.sh |   76 ++++++++++++++++++++++++++++++++++++\n t/t9130/clean.dump                 |   74 +++++++++++++++++++++++++++++++++++\n 2 files changed, 150 insertions(+), 0 deletions(-)\n create mode 100755 t/t9130-git-svn-externals-fetch.sh\n create mode 100644 t/t9130/clean.dump\n\ndiff --git a/t/t9130-git-svn-externals-fetch.sh b/t/t9130-git-svn-externals-fetch.sh\nnew file mode 100755\nindex 0000000..70335ad\n--- /dev/null\n+++ b/t/t9130-git-svn-externals-fetch.sh\n@@ -0,0 +1,76 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2008 Eddy PetriÈor\n+\n+\n+test_description='git svn properties pulls and updates externals'\n+. ./lib-git-svn.sh\n+\n+test_expect_success 'load repository with base directory' '\n+\tsvnadmin load -q \"$rawsvnrepo\" < ../t9130/clean.dump\n+\t'\n+\n+test_expect_success 'checkout the simple repo' '\n+\tmkdir -p gitrepo &&\n+\t(\n+\t\tcd gitrepo &&\n+\t\tgit svn init \"$svnrepo/trunk\" &&\n+\t\tgit svn fetch &&\n+\t\tcd ..\n+\t)\n+\t'\n+\n+test_expect_success 'add an external in the repo' '\n+\tsvn checkout \"$svnrepo/trunk\" work.svn &&\n+\t(\n+\t\tcd work.svn &&\n+\t\tsvn propset svn:externals \"external $(echo $svnrepo|sed \"s#\\ #%20#\")/external\" . &&\n+\t\tsvn commit -m \"added external directory to repo\" &&\n+\t\tsvn update &&\n+\t\tcd .. &&\n+\t\trm -fr work.svn\n+\t)\n+\t'\n+\n+test_expect_success 'git svn fetch the property changes and fetch externals' '\n+\tcd gitrepo &&\n+\tgit svn rebase &&\n+\tgit svn show-externals | grep -q \"^/external\" &&\n+\tgit svn-externals &&\n+\tcd ..\n+\t'\n+\n+test_expect_success 'create an external pinned to a version' '\n+\tsvn checkout \"$svnrepo/trunk\" work.svn &&\n+\t(\n+\t\tcd work.svn &&\n+\t\tsvn propset svn:externals \"external -r2 $(echo $svnrepo|sed \"s#\\ #%20#\")/external\" . &&\n+\t\tsvn commit -m \"pin the external to -r2\" &&\n+\t\tsvn update &&\n+\t\tcd .. &&\n+\t\trm -fr work.svn\n+\t) &&\n+\tsvn checkout \"$svnrepo/external\" ext.svn &&\n+\t(\n+\t\tcd ext.svn &&\n+\t\techo \"0\" > externalfile &&\n+\t\tsvn commit -m \"mark the bad floating revision for the external\" &&\n+\t\tcd .. &&\n+\t\trm -fr ext.svn\n+\t)\n+\t'\n+\n+test_expect_failure 'refresh revisioned externals in git' '\n+\tcd gitrepo &&\n+\tgit config --list >> /tmp/test &&\n+\tgit svn rebase &&\n+\tgit svn-externals &&\n+\tgrep 1 external/externalfile &&\n+\tcd ..\n+\t'\n+\n+#TODO: add test_expect_success for a URI change for the external\n+\n+\n+\n+test_done\ndiff --git a/t/t9130/clean.dump b/t/t9130/clean.dump\nnew file mode 100644\nindex 0000000..9e26b66\n--- /dev/null\n+++ b/t/t9130/clean.dump\n@@ -0,0 +1,74 @@\n+SVN-fs-dump-format-version: 2\n+\n+UUID: 13066bdd-4590-4b1e-8a3f-4379dfa77d1b\n+\n+Revision-number: 0\n+Prop-content-length: 56\n+Content-length: 56\n+\n+K 8\n+svn:date\n+V 27\n+2008-07-10T11:26:12.351202Z\n+PROPS-END\n+\n+Revision-number: 1\n+Prop-content-length: 125\n+Content-length: 125\n+\n+K 7\n+svn:log\n+V 26\n+bare structure of the repo\n+K 10\n+svn:author\n+V 4\n+eddy\n+K 8\n+svn:date\n+V 27\n+2008-07-10T11:31:04.711302Z\n+PROPS-END\n+\n+Node-path: external\n+Node-kind: dir\n+Node-action: add\n+Prop-content-length: 10\n+Content-length: 10\n+\n+PROPS-END\n+\n+\n+Node-path: external/externalfile\n+Node-kind: file\n+Node-action: add\n+Prop-content-length: 10\n+Text-content-length: 2\n+Text-content-md5: b026324c6904b2a9cb4b88d6d61c81d1\n+Content-length: 12\n+\n+PROPS-END\n+1\n+\n+\n+Node-path: trunk\n+Node-kind: dir\n+Node-action: add\n+Prop-content-length: 10\n+Content-length: 10\n+\n+PROPS-END\n+\n+\n+Node-path: trunk/dummyfile\n+Node-kind: file\n+Node-action: add\n+Prop-content-length: 10\n+Text-content-length: 1\n+Text-content-md5: 68b329da9893e34099c7d8ad5cb9c940\n+Content-length: 11\n+\n+PROPS-END\n+\n+\n+\n-- \n1.5.6.3\n"},{"id":"89064","messageId":"60381eeb0808281716l512a4ac5kc7ba41c0d00e6baa@mail.gmail.com","threadId":"15266","inReplyTo":"60381eeb0808281702q3dc7543enff2b35ebbcc80d08@mail.gmail.com","subject":"Re: [PATCH 0/3] git-svn-externals PoC (in a sh script)","fromName":"Eddy Petrișor","fromEmail":"eddy.petrisor@gmail.com","sentAt":"2008-08-29T00:16:00Z","receivedAt":"2008-08-29T00:16:00Z","isPatch":true,"sender":{"key":"eddy.petrisor@gmail.com","avatar":"https://gravatar.com/avatar/e13eef6cecbe95604b4667c7bddf5aee2bb4af684c5fdceaf9e2aebfead3e9f5?d=mp&s=160"},"body":"Please CC me, I am not listed.\n\n2008/8/29 Eddy Petrișor <eddy.petrisor@gmail.com>:\n> Hello,\n>\n> I have started a while back working on support for svn:externals\n> support for git-svn, but since I'm not that satisfied with the current\n> status of the patch, I haven't modified git-svn itself and just left\n> the sh script I made as a PoC as it was.\n>\n> There's still work to be done to it, but I the current version is\n> functional enough to be probably found useful by more people than\n> myself.\n>\n>\n> Current status follows:\n>\n>    Current functionality:\n>     - fetches all the externals of an already svn-fetched repo\n>     - support for svn:externals refresh\n>     - if the location of the external has changed, the current working\n>       copy will be placed aside and a new directory will be created\n>       instead\n>     - if the remote URI is the same (maybe a verison bump, there will\n>       be a 'git svn rebase'\n>     - remove support (useful for testing purposes or clean restarts)\n>     - avoid zombie externals at all costs - in some repos empty\n>       svn:externals might exist; svn ignores such externals, so git should\n>       do the same\n>\n>    TODO:\n>     - take into account the revision of an external, if it exists\n>     - do not do deep svn cloning, to avoid legthy operations, just pull HEAD\n>       (this actually needs changes in git-svn itself)\n>     - use/create shallow copies to git svn repos (one revision should be enough\n>       for most externals)\n>     - use submodules for externals\n>\n>\n>\n>\n> Any comments are welcome.\n>\n>\n> --\n> Regards,\n> EddyP\n> =============================================\n> \"Imagination is more important than knowledge\" A.Einstein\n>\n\n\n\n-- \nRegards,\nEddyP\n=============================================\n\"Imagination is more important than knowledge\" A.Einstein\n"},{"id":"89109","messageId":"20080829092927.GA7500@yp-box.dyndns.org","threadId":"15266","inReplyTo":"60381eeb0808281702q3dc7543enff2b35ebbcc80d08@mail.gmail.com","subject":"Re: [PATCH 0/3] git-svn-externals PoC (in a sh script)","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-08-29T09:29:27Z","receivedAt":"2008-08-29T09:29:27Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Eddy Petrișor <eddy.petrisor@gmail.com> wrote:\n> Hello,\n\nHi Eddy,\n\n> I have started a while back working on support for svn:externals\n> support for git-svn, but since I'm not that satisfied with the current\n> status of the patch, I haven't modified git-svn itself and just left\n> the sh script I made as a PoC as it was.\n> \n> There's still work to be done to it, but I the current version is\n> functional enough to be probably found useful by more people than\n> myself.\n\nCool.\n\nI definitely like the separate script approach.  Not sure if you read my\nposts, your PoC seems inline with my thoughts on handling externals be\nseen here:\n\nhttp://article.gmane.org/gmane.comp.version-control.git/91283\nhttp://article.gmane.org/gmane.comp.version-control.git/91293\n\n> Current status follows:\n> \n>     Current functionality:\n>      - fetches all the externals of an already svn-fetched repo\n>      - support for svn:externals refresh\n>      - if the location of the external has changed, the current working\n>        copy will be placed aside and a new directory will be created\n>        instead\n>      - if the remote URI is the same (maybe a verison bump, there will\n>        be a 'git svn rebase'\n>      - remove support (useful for testing purposes or clean restarts)\n>      - avoid zombie externals at all costs - in some repos empty\n>        svn:externals might exist; svn ignores such externals, so git should\n>        do the same\n> \n>     TODO:\n>      - take into account the revision of an external, if it exists\n>      - do not do deep svn cloning, to avoid legthy operations, just pull HEAD\n>        (this actually needs changes in git-svn itself)\n\ngit svn clone -r<latest_revision_number> URL should work if you extract\nthe revision number easily.  Specifying \"-rHEAD\" will only work if the\nbranch of the external you're tracking was the last modified revision in\nthe repository, so it's not very useful.  \"svn log\" seems to have the\nsame semantics as git-svn as far as -rHEAD being useful or not...\n\n>      - use/create shallow copies to git svn repos (one revision should be enough\n>        for most externals)\n>      - use submodules for externals\n\nI'm not sure if mapping submodules to externals is a good idea\nbecause externals don't require exact revisions and submodules do.\nThere's also an issue I was just made aware of two days ago with\nsubmodules and git-svn that I haven't had time to work on.\n\nAnother user also privately reported a bug to me about git-svn having\ntrouble dcommitting when using submodules.  I've attached the test case\nhere in case you have any thoughts on how to handle this (I think the\neasiest would be to ignore submodules on dcommit entirely).\n\n> Any comments are welcome.\n\nAlso some small portability issues: \"grep -q\" is definitely unportable\nin my experience.  There are probably some more that I am missing my eye\nat this time of night...\n\n-- \nEric Wong\n"},{"id":"89364","messageId":"20080901062050.GA29870@untitled","threadId":"15266","inReplyTo":"20080829092927.GA7500@yp-box.dyndns.org","subject":"RFH: git-svn and submodules","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-09-01T06:20:50Z","receivedAt":"2008-09-01T06:20:50Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Eric Wong <normalperson@yhbt.net> wrote:\n> Eddy Petrișor <eddy.petrisor@gmail.com> wrote:\n> >      - use submodules for externals\n> \n> I'm not sure if mapping submodules to externals is a good idea\n> because externals don't require exact revisions and submodules do.\n> There's also an issue I was just made aware of two days ago with\n> submodules and git-svn that I haven't had time to work on.\n\nDefinitely a complex problem.  A new submodule from git mapping to an\nnew svn:external probably doesn't work very well, either.  There's also\nUI/policy issues with creating a new directory/branch in SVN to house\nthe external.  It will also will not work for (the few) projects that\nare using the root of the SVN repository directly.\n\n> Another user also privately reported a bug to me about git-svn having\n> trouble dcommitting when using submodules.  I've attached the test case\n> here in case you have any thoughts on how to handle this (I think the\n> easiest would be to ignore submodules on dcommit entirely).\n\nWell, I'm stuck on this problem.  Since that user that reported this\nemailed me privately, I'm bcc-ing him on this issue, too.\n\nI've tried the following, and it gets the commit into SVN without the\nsubmodules using dcommit.\n\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -3364,7 +3364,7 @@ sub new {\n \n sub generate_diff {\n \tmy ($tree_a, $tree_b) = @_;\n-\tmy @diff_tree = qw(diff-tree -z -r);\n+\tmy @diff_tree = qw(diff-tree --ignore-submodules -z -r);\n \tif ($_cp_similarity) {\n \t\tpush @diff_tree, \"-C$_cp_similarity\";\n \t} else {\n\nHowever, all is not well.  The rebase/reset step in dcommit gets\ntriggered with a rebase because the submodule is dropped from the tree\nwhen we refetch the commit from SVN.\n\n\nThe simplest would be to say we don't support mixing submodules with\ngit-svn.  I'm fine with this statement.\n\n\nThe clever way would be introducing a custom revprop for git-svn\nto use to declare submodule dependencies.  Then git-svn can\nrecreate the information needed for a revprop on fetch.\n\nThat would mean regular SVN users would not get access to submodules.\n\nCutting SVN users off from being able to effectively use an SVN repo\ndoesn't make sense to me.  The project might as well be using git\nentirely and ditch SVN.  Of course, some PHB somewhere will want to keep\nthe project on SVN even when all the developers are using git-svn...\n\n\n\nSince gmane seems to have broken the attachment I previously sent,\nhere again is the patch inlined:\n\nFrom bddc57078188d4798a9a74401aa0da8ca35a4db1 Mon Sep 17 00:00:00 2001\nFrom: Eric Wong <normalperson@yhbt.net>\nDate: Fri, 29 Aug 2008 02:09:50 -0700\nSubject: [PATCH] git-svn: Add submodule ignore test\n\n---\n t/t9126-git-svn-submodule.sh |   44 ++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 44 insertions(+), 0 deletions(-)\n create mode 100644 t/t9126-git-svn-submodule.sh\n\ndiff --git a/t/t9126-git-svn-submodule.sh b/t/t9126-git-svn-submodule.sh\nnew file mode 100644\nindex 0000000..c4b3489\n--- /dev/null\n+++ b/t/t9126-git-svn-submodule.sh\n@@ -0,0 +1,44 @@\n+#!/bin/sh\n+# Copyright (c) 2008 Eric Wong\n+\n+test_description='git-svn submodule'\n+\n+. ./lib-git-svn.sh\n+\n+test_expect_success 'setup repo' 'svn co \"$svnrepo\" svnfoo'\n+\n+test_expect_success 'add files to svn repo' '\n+\ttouch svnfoo/foo.txt\n+\t(cd svnfoo && svn add * && svn commit -m \"test commit\")\n+\t'\n+\n+test_expect_success 'git-svn clone the svn repo' '\n+\tgit-svn clone \"$svnrepo\" gitfoo\n+\t'\n+\n+test_expect_success 'create a git repo to include as a submodule' '\n+\tmkdir git_to_include\n+\t(\n+\t\tcd git_to_include &&\n+\t\tgit init &&\n+\t\techo \"This is another file\" > another.txt &&\n+\t\tgit add another.txt &&\n+\t\tgit commit -a -m \"Adding file to submodule\" &&\n+\t\tgit log\n+\t)\n+\t'\n+\n+test_expect_success 'add the submodule' '\n+\t(\n+\t\tcd gitfoo &&\n+\t\tgit submodule add \"$remove_trash\"/git_to_include \\\n+\t\t  git_as_submodule &&\n+\t\tgit commit -a -m \"Adding submodule\"\n+\t)\n+\t'\n+\n+test_expect_success 'try to rebase and commit' '\n+\t( cd gitfoo && git svn rebase && git svn dcommit )\n+\t'\n+\n+test_done\n-- \nEric Wong\n"},{"id":"90349","messageId":"60381eeb0809100656u1117cfb6i72e327495d513f9c@mail.gmail.com","threadId":"15266","inReplyTo":"20080829092927.GA7500@yp-box.dyndns.org","subject":"Re: [PATCH 0/3] git-svn-externals PoC (in a sh script)","fromName":"Eddy Petrișor","fromEmail":"eddy.petrisor@gmail.com","sentAt":"2008-09-10T13:56:10Z","receivedAt":"2008-09-10T13:56:10Z","isPatch":true,"sender":{"key":"eddy.petrisor@gmail.com","avatar":"https://gravatar.com/avatar/e13eef6cecbe95604b4667c7bddf5aee2bb4af684c5fdceaf9e2aebfead3e9f5?d=mp&s=160"},"body":"(Please keep the CC. Thanks)\n\n2008/8/29 Eric Wong <normalperson@yhbt.net>:\n> Eddy Petrișor <eddy.petrisor@gmail.com> wrote:\n>> Hello,\n>\n> Hi Eddy,\n\nHello and sorry for the late reply.\n\n(I was on a small vacation away from the computer in the last two weeks.)\n\n>> I have started a while back working on support for svn:externals\n>> support for git-svn, but since I'm not that satisfied with the current\n>> status of the patch, I haven't modified git-svn itself and just left\n>> the sh script I made as a PoC as it was.\n>>\n>> There's still work to be done to it, but I the current version is\n>> functional enough to be probably found useful by more people than\n>> myself.\n>\n> Cool.\n>\n> I definitely like the separate script approach.  Not sure if you read my\n> posts, your PoC seems inline with my thoughts on handling externals be\n> seen here:\n>\n> http://article.gmane.org/gmane.comp.version-control.git/91283\n> http://article.gmane.org/gmane.comp.version-control.git/91293\n\nWRT the revision pinning, it seems to me that is enough to locate that\nrevision on the URI in question and checkout that revision. Still I am\nunsure if it would be wise to (stash +) svn rebase + checkout the\npinned version (+ stash pop), since one would needlessly pull newer\nstuff as the remote svn HEAD advances, but the pinned version might\nsimply stagnate.\n\n\nI already have/wrote some code that follows the remote HEAD or a\nspecific for the necessary, but I am unsure if is still present in the\nPoC script, is not that hard (in sh - a \"svn info\" on the URI, not on\nthe local copy would reveal the real revision of the HEAD).\n\n>> Current status follows:\n>>\n>>     Current functionality:\n>>      - fetches all the externals of an already svn-fetched repo\n>>      - support for svn:externals refresh\n>>      - if the location of the external has changed, the current working\n>>        copy will be placed aside and a new directory will be created\n>>        instead\n>>      - if the remote URI is the same (maybe a verison bump, there will\n>>        be a 'git svn rebase'\n>>      - remove support (useful for testing purposes or clean restarts)\n>>      - avoid zombie externals at all costs - in some repos empty\n>>        svn:externals might exist; svn ignores such externals, so git should\n>>        do the same\n>>\n>>     TODO:\n>>      - take into account the revision of an external, if it exists\n>>      - do not do deep svn cloning, to avoid legthy operations, just pull HEAD\n>>        (this actually needs changes in git-svn itself)\n>\n> git svn clone -r<latest_revision_number> URL should work if you extract\n> the revision number easily.\n\nWhy was I under the impression that this wasn't working? Or was I\nexpecting a shallow repo?\n\n> Specifying \"-rHEAD\" will only work if the\n> branch of the external you're tracking was the last modified revision in\n> the repository, so it's not very useful.\n\nas I already said, \"svn info URI\" can return the real revision, no\nneed to ness with the pseudo-revision HEAD.\n\n>  \"svn log\" seems to have the\n> same semantics as git-svn as far as -rHEAD being useful or not...\n>\n>>      - use/create shallow copies to git svn repos (one revision should be enough\n>>        for most externals)\n>>      - use submodules for externals\n>\n> I'm not sure if mapping submodules to externals is a good idea\n> because externals don't require exact revisions and submodules do.\n\nI don't think I can follow you. Externals actually require exact\nrevisions or can be made to pretend as if they do in git-svn context\nwith continuous HEAD refresh.\n\n> There's also an issue I was just made aware of two days ago with\n> submodules and git-svn that I haven't had time to work on.\n>\n> Another user also privately reported a bug to me about git-svn having\n> trouble dcommitting when using submodules.  I've attached the test case\n> here in case you have any thoughts on how to handle this (I think the\n> easiest would be to ignore submodules on dcommit entirely).\n\nProbably, and try later to tackle the problem.\n\n>> Any comments are welcome.\n>\n> Also some small portability issues: \"grep -q\" is definitely unportable\n> in my experience.  There are probably some more that I am missing my eye\n> at this time of night...\n\nWill fix it.\n\n-- \nRegards,\nEddyP\n=============================================\n\"Imagination is more important than knowledge\" A.Einstein\n"},{"id":"90350","messageId":"60381eeb0809100659m2d553da7w4e18377a479b9d61@mail.gmail.com","threadId":"15266","inReplyTo":"60381eeb0809100656u1117cfb6i72e327495d513f9c@mail.gmail.com","subject":"Re: [PATCH 0/3] git-svn-externals PoC (in a sh script)","fromName":"Eddy Petrișor","fromEmail":"eddy.petrisor@gmail.com","sentAt":"2008-09-10T13:59:18Z","receivedAt":"2008-09-10T13:59:18Z","isPatch":true,"sender":{"key":"eddy.petrisor@gmail.com","avatar":"https://gravatar.com/avatar/e13eef6cecbe95604b4667c7bddf5aee2bb4af684c5fdceaf9e2aebfead3e9f5?d=mp&s=160"},"body":"2008/9/10 Eddy Petrișor <eddy.petrisor@gmail.com>:\n> (Please keep the CC. Thanks)\n> I already have/wrote some code that follows the remote HEAD or a\n> specific for the necessary, but I am unsure if is still present in the\n\nThat was supposed to be:\n\n> specific revision for such cases, but I am unsure if is still present in the\n\n\n-- \nRegards,\nEddyP\n=============================================\n\"Imagination is more important than knowledge\" A.Einstein\n"}]}