{"thread":{"id":"35494","subject":"[PATCH 0/4] remote-helpers: fixes","startedAt":"2013-12-07T13:09:39Z","lastAt":"2013-12-23T20:23:43Z","messageCount":8,"participants":["Felipe Contreras","Antoine Pelisse","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"231701","messageId":"1386421783-27781-1-git-send-email-felipe.contreras@gmail.com","threadId":"35494","inReplyTo":null,"subject":"[PATCH 0/4] remote-helpers: fixes","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-12-07T13:09:39Z","receivedAt":"2013-12-07T13:09:39Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Felipe Contreras (3):\n  remote-helpers: add extra safety checks\n  remote-hg: fix 'shared path' path\n  remote-hg: add tests for special filenames\n\njcb91 (1):\n  remote-hg: avoid buggy strftime()\n\n contrib/remote-helpers/git-remote-bzr | 14 +++++---\n contrib/remote-helpers/git-remote-hg  | 19 +++++++---\n contrib/remote-helpers/test-hg.sh     | 68 +++++++++++++++++++++++++++++++++++\n 3 files changed, 92 insertions(+), 9 deletions(-)\n\n-- \n1.8.4.2+fc1\n"},{"id":"231702","messageId":"1386421783-27781-2-git-send-email-felipe.contreras@gmail.com","threadId":"35494","inReplyTo":"1386421783-27781-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 1/4] remote-hg: avoid buggy strftime()","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-12-07T13:09:40Z","receivedAt":"2013-12-07T13:09:40Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"From: jcb91 <joshuacookebarnes@gmail.com>\n\n  error on pull: fatal: Invalid raw date \"\" in ident: remote-hg <>\n\nNeither %s nor %z are officially supported by python, they may work on\nsome (most?) platforms, but not all.\n\nremoved strftime use of %s and %z, which are not officially supported by python, with standard formats\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/remote-helpers/git-remote-hg | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg\nindex c6026b9..a81d59e 100755\n--- a/contrib/remote-helpers/git-remote-hg\n+++ b/contrib/remote-helpers/git-remote-hg\n@@ -538,7 +538,7 @@ def export_ref(repo, name, kind, head):\n \n         print \"commit %s\" % ref\n         print \"mark :%d\" % (note_mark)\n-        print \"committer remote-hg <> %s\" % (ptime.strftime('%s %z'))\n+        print \"committer remote-hg <> %d %s\" % (ptime.time(), gittz(ptime.timezone))\n         desc = \"Notes for %s\\n\" % (name)\n         print \"data %d\" % (len(desc))\n         print desc\n-- \n1.8.4.2+fc1\n"},{"id":"231703","messageId":"1386421783-27781-3-git-send-email-felipe.contreras@gmail.com","threadId":"35494","inReplyTo":"1386421783-27781-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 2/4] remote-helpers: add extra safety checks","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-12-07T13:09:41Z","receivedAt":"2013-12-07T13:09:41Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Suggested-by: Roman Ovchinnikov <coolthecold@gmail.com>\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/remote-helpers/git-remote-bzr | 14 ++++++++++----\n contrib/remote-helpers/git-remote-hg  | 14 ++++++++++----\n 2 files changed, 20 insertions(+), 8 deletions(-)\n\ndiff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr\nindex 054161a..858ba3c 100755\n--- a/contrib/remote-helpers/git-remote-bzr\n+++ b/contrib/remote-helpers/git-remote-bzr\n@@ -884,6 +884,16 @@ def main(args):\n     global branches, peers\n     global transports\n \n+    marks = None\n+    is_tmp = False\n+    gitdir = os.environ.get('GIT_DIR', None)\n+\n+    if len(args) < 3:\n+        die('Not enough arguments.')\n+\n+    if not gitdir:\n+        die('GIT_DIR not set')\n+\n     alias = args[1]\n     url = args[2]\n \n@@ -892,7 +902,6 @@ def main(args):\n     blob_marks = {}\n     parsed_refs = {}\n     files_cache = {}\n-    marks = None\n     branches = {}\n     peers = {}\n     transports = []\n@@ -900,11 +909,8 @@ def main(args):\n     if alias[5:] == url:\n         is_tmp = True\n         alias = hashlib.sha1(alias).hexdigest()\n-    else:\n-        is_tmp = False\n \n     prefix = 'refs/bzr/%s' % alias\n-    gitdir = os.environ['GIT_DIR']\n     dirname = os.path.join(gitdir, 'bzr', alias)\n \n     if not is_tmp:\ndiff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg\nindex a81d59e..aa1d230 100755\n--- a/contrib/remote-helpers/git-remote-hg\n+++ b/contrib/remote-helpers/git-remote-hg\n@@ -1165,6 +1165,16 @@ def main(args):\n     global dry_run\n     global notes, alias\n \n+    marks = None\n+    is_tmp = False\n+    gitdir = os.environ.get('GIT_DIR', None)\n+\n+    if len(args) < 3:\n+        die('Not enough arguments.')\n+\n+    if not gitdir:\n+        die('GIT_DIR not set')\n+\n     alias = args[1]\n     url = args[2]\n     peer = None\n@@ -1185,16 +1195,12 @@ def main(args):\n     if alias[4:] == url:\n         is_tmp = True\n         alias = hashlib.sha1(alias).hexdigest()\n-    else:\n-        is_tmp = False\n \n-    gitdir = os.environ['GIT_DIR']\n     dirname = os.path.join(gitdir, 'hg', alias)\n     branches = {}\n     bmarks = {}\n     blob_marks = {}\n     parsed_refs = {}\n-    marks = None\n     parsed_tags = {}\n     filenodes = {}\n     fake_bmark = None\n-- \n1.8.4.2+fc1\n"},{"id":"231704","messageId":"1386421783-27781-4-git-send-email-felipe.contreras@gmail.com","threadId":"35494","inReplyTo":"1386421783-27781-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 3/4] remote-hg: fix 'shared path' path","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-12-07T13:09:42Z","receivedAt":"2013-12-07T13:09:42Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"If the repository is moved, the absolute path of the shared repository\nwould fail.\n\nMake sure it's always up-to-date.\n\nReported-by: Michael Davis <mjmdavis@gmail.com>\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/remote-helpers/git-remote-hg | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg\nindex aa1d230..718ef95 100755\n--- a/contrib/remote-helpers/git-remote-hg\n+++ b/contrib/remote-helpers/git-remote-hg\n@@ -416,6 +416,9 @@ def get_repo(url, alias):\n         local_path = os.path.join(dirname, 'clone')\n         if not os.path.exists(local_path):\n             hg.share(myui, shared_path, local_path, update=False)\n+        else:\n+            # make sure the shared path is always up-to-date\n+            util.writefile(os.path.join(local_path, '.hg', 'sharedpath'), hg_path)\n \n         repo = hg.repository(myui, local_path)\n         try:\n-- \n1.8.4.2+fc1\n"},{"id":"231705","messageId":"1386421783-27781-5-git-send-email-felipe.contreras@gmail.com","threadId":"35494","inReplyTo":"1386421783-27781-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 4/4] remote-hg: add tests for special filenames","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-12-07T13:09:43Z","receivedAt":"2013-12-07T13:09:43Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"So that we check that UTF-8 and spaces work fine.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/remote-helpers/test-hg.sh | 68 +++++++++++++++++++++++++++++++++++++++\n 1 file changed, 68 insertions(+)\n\ndiff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh\nindex 72f745d..56840ff 100755\n--- a/contrib/remote-helpers/test-hg.sh\n+++ b/contrib/remote-helpers/test-hg.sh\n@@ -442,6 +442,74 @@ test_expect_success 'remote new bookmark multiple branch head' '\n # cleanup previous stuff\n rm -rf hgrepo\n \n+test_expect_success 'fetch special filenames' '\n+\ttest_when_finished \"rm -rf hgrepo gitrepo && LC_ALL=C\" &&\n+\n+\tLC_ALL=en_US.UTF-8\n+\texport LC_ALL\n+\n+\t(\n+\thg init hgrepo &&\n+\tcd hgrepo &&\n+\n+\techo test >> \"æ rø\" &&\n+\thg add \"æ rø\" &&\n+\techo test >> \"ø~?\" &&\n+\thg add \"ø~?\" &&\n+\thg commit -m add-utf-8 &&\n+\techo test >> \"æ rø\" &&\n+\thg commit -m test-utf-8 &&\n+\thg rm \"ø~?\" &&\n+\thg mv \"æ rø\" \"ø~?\" &&\n+\thg commit -m hg-mv-utf-8\n+\t) &&\n+\n+\t(\n+\tgit clone \"hg::hgrepo\" gitrepo &&\n+\tcd gitrepo &&\n+\tgit -c core.quotepath=false ls-files > ../actual\n+\t) &&\n+\techo \"ø~?\" > expected &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success 'push special filenames' '\n+\ttest_when_finished \"rm -rf hgrepo gitrepo && LC_ALL=C\" &&\n+\n+\tmkdir -p tmp && cd tmp &&\n+\n+\tLC_ALL=en_US.UTF-8\n+\texport LC_ALL\n+\n+\t(\n+\thg init hgrepo &&\n+\tcd hgrepo &&\n+\n+\techo one >> content &&\n+\thg add content &&\n+\thg commit -m one\n+\t) &&\n+\n+\t(\n+\tgit clone \"hg::hgrepo\" gitrepo &&\n+\tcd gitrepo &&\n+\n+\techo test >> \"æ rø\" &&\n+\tgit add \"æ rø\" &&\n+\tgit commit -m utf-8 &&\n+\n+\tgit push\n+\t) &&\n+\n+\t(cd hgrepo &&\n+\thg update &&\n+\thg manifest > ../actual\n+\t) &&\n+\n+\tprintf \"content\\næ rø\\n\" > expected &&\n+\ttest_cmp expected actual\n+'\n+\n setup_big_push () {\n \t(\n \thg init hgrepo &&\n-- \n1.8.4.2+fc1\n"},{"id":"231976","messageId":"CALWbr2wkSNDh2VTz05sndymUe=fOsApMrg6Jjp0a6mbEfhru=g@mail.gmail.com","threadId":"35494","inReplyTo":"1386421783-27781-4-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH 3/4] remote-hg: fix 'shared path' path","fromName":"Antoine Pelisse","fromEmail":"apelisse@gmail.com","sentAt":"2013-12-13T17:58:04Z","receivedAt":"2013-12-13T17:58:04Z","isPatch":true,"sender":{"key":"apelisse@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1929644?v=4"},"body":"On Sat, Dec 7, 2013 at 2:09 PM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> If the repository is moved, the absolute path of the shared repository\n> would fail.\n>\n> Make sure it's always up-to-date.\n>\n> Reported-by: Michael Davis <mjmdavis@gmail.com>\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  contrib/remote-helpers/git-remote-hg | 3 +++\n>  1 file changed, 3 insertions(+)\n>\n> diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg\n> index aa1d230..718ef95 100755\n> --- a/contrib/remote-helpers/git-remote-hg\n> +++ b/contrib/remote-helpers/git-remote-hg\n> @@ -416,6 +416,9 @@ def get_repo(url, alias):\n>          local_path = os.path.join(dirname, 'clone')\n>          if not os.path.exists(local_path):\n>              hg.share(myui, shared_path, local_path, update=False)\n> +        else:\n> +            # make sure the shared path is always up-to-date\n> +            util.writefile(os.path.join(local_path, '.hg', 'sharedpath'), hg_path)\n\nConsidering this is modifying a \"private mercurial file\", would it\nmake sense to include a test like I did in my equivalent patch ?\n"},{"id":"232121","messageId":"xmqqzjnzktdr.fsf@gitster.dls.corp.google.com","threadId":"35494","inReplyTo":"CALWbr2wkSNDh2VTz05sndymUe=fOsApMrg6Jjp0a6mbEfhru=g@mail.gmail.com","subject":"Re: [PATCH 3/4] remote-hg: fix 'shared path' path","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-12-17T22:25:04Z","receivedAt":"2013-12-17T22:25:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Antoine Pelisse <apelisse@gmail.com> writes:\n\n> On Sat, Dec 7, 2013 at 2:09 PM, Felipe Contreras\n> <felipe.contreras@gmail.com> wrote:\n>> If the repository is moved, the absolute path of the shared repository\n>> would fail.\n>>\n>> Make sure it's always up-to-date.\n>>\n>> Reported-by: Michael Davis <mjmdavis@gmail.com>\n>> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n>> ---\n>>  contrib/remote-helpers/git-remote-hg | 3 +++\n>>  1 file changed, 3 insertions(+)\n>>\n>> diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg\n>> index aa1d230..718ef95 100755\n>> --- a/contrib/remote-helpers/git-remote-hg\n>> +++ b/contrib/remote-helpers/git-remote-hg\n>> @@ -416,6 +416,9 @@ def get_repo(url, alias):\n>>          local_path = os.path.join(dirname, 'clone')\n>>          if not os.path.exists(local_path):\n>>              hg.share(myui, shared_path, local_path, update=False)\n>> +        else:\n>> +            # make sure the shared path is always up-to-date\n>> +            util.writefile(os.path.join(local_path, '.hg', 'sharedpath'), hg_path)\n>\n> Considering this is modifying a \"private mercurial file\", would it\n> make sense to include a test like I did in my equivalent patch ?\n\nHmph. I was planning to merge the topic to 'next' today; perhaps the\nnecessary tests can come as a follow-up patch on top of the topic\nbefore it graduates to 'master'?\n"},{"id":"232364","messageId":"1387830223-19780-1-git-send-email-apelisse@gmail.com","threadId":"35494","inReplyTo":"xmqqzjnzktdr.fsf@gitster.dls.corp.google.com","subject":"[PATCH] remote-hg: test 'shared_path' in a moved clone","fromName":"Antoine Pelisse","fromEmail":"apelisse@gmail.com","sentAt":"2013-12-23T20:23:43Z","receivedAt":"2013-12-23T20:23:43Z","isPatch":true,"sender":{"key":"apelisse@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1929644?v=4"},"body":"Since e71d1378 (remote-hg: fix 'shared path' path, 2013-12-07),\nMercurial 'shared_path' file is correctly updated whenever a clone is\nmoved. Make sure it keeps working, especially as this is depending on a\nprivate Mercurial file.\n\nSigned-off-by: Antoine Pelisse <apelisse@gmail.com>\n---\n contrib/remote-helpers/test-hg.sh | 11 +++++++++++\n 1 file changed, 11 insertions(+)\n\ndiff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh\nindex 0b7df11..5d128a5 100755\n--- a/contrib/remote-helpers/test-hg.sh\n+++ b/contrib/remote-helpers/test-hg.sh\n@@ -337,6 +337,17 @@ test_expect_success 'remote cloning' '\n \tcheck gitrepo HEAD zero\n '\n \n+test_expect_success 'moving remote clone' '\n+\ttest_when_finished \"rm -rf gitrepo*\" &&\n+\n+\t(\n+\tgit clone \"hg::hgrepo\" gitrepo &&\n+\tmv gitrepo gitrepo2 &&\n+\tcd gitrepo2 &&\n+\tgit fetch\n+\t)\n+'\n+\n test_expect_success 'remote update bookmark' '\n \ttest_when_finished \"rm -rf gitrepo*\" &&\n \n-- \n1.8.5.1.97.g8d784da.dirty\n"}]}