All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] remote-helpers: fixes
@ 2013-12-07 13:09 Felipe Contreras
  2013-12-07 13:09 ` [PATCH 1/4] remote-hg: avoid buggy strftime() Felipe Contreras
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Felipe Contreras @ 2013-12-07 13:09 UTC (permalink / raw)
  To: git; +Cc: Felipe Contreras

Felipe Contreras (3):
  remote-helpers: add extra safety checks
  remote-hg: fix 'shared path' path
  remote-hg: add tests for special filenames

jcb91 (1):
  remote-hg: avoid buggy strftime()

 contrib/remote-helpers/git-remote-bzr | 14 +++++---
 contrib/remote-helpers/git-remote-hg  | 19 +++++++---
 contrib/remote-helpers/test-hg.sh     | 68 +++++++++++++++++++++++++++++++++++
 3 files changed, 92 insertions(+), 9 deletions(-)

-- 
1.8.4.2+fc1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/4] remote-hg: avoid buggy strftime()
  2013-12-07 13:09 [PATCH 0/4] remote-helpers: fixes Felipe Contreras
@ 2013-12-07 13:09 ` Felipe Contreras
  2013-12-07 13:09 ` [PATCH 2/4] remote-helpers: add extra safety checks Felipe Contreras
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2013-12-07 13:09 UTC (permalink / raw)
  To: git; +Cc: jcb91, Felipe Contreras

From: jcb91 <joshuacookebarnes@gmail.com>

  error on pull: fatal: Invalid raw date "" in ident: remote-hg <>

Neither %s nor %z are officially supported by python, they may work on
some (most?) platforms, but not all.

removed strftime use of %s and %z, which are not officially supported by python, with standard formats

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/remote-helpers/git-remote-hg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index c6026b9..a81d59e 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -538,7 +538,7 @@ def export_ref(repo, name, kind, head):
 
         print "commit %s" % ref
         print "mark :%d" % (note_mark)
-        print "committer remote-hg <> %s" % (ptime.strftime('%s %z'))
+        print "committer remote-hg <> %d %s" % (ptime.time(), gittz(ptime.timezone))
         desc = "Notes for %s\n" % (name)
         print "data %d" % (len(desc))
         print desc
-- 
1.8.4.2+fc1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/4] remote-helpers: add extra safety checks
  2013-12-07 13:09 [PATCH 0/4] remote-helpers: fixes Felipe Contreras
  2013-12-07 13:09 ` [PATCH 1/4] remote-hg: avoid buggy strftime() Felipe Contreras
@ 2013-12-07 13:09 ` Felipe Contreras
  2013-12-07 13:09 ` [PATCH 3/4] remote-hg: fix 'shared path' path Felipe Contreras
  2013-12-07 13:09 ` [PATCH 4/4] remote-hg: add tests for special filenames Felipe Contreras
  3 siblings, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2013-12-07 13:09 UTC (permalink / raw)
  To: git; +Cc: Felipe Contreras

Suggested-by: Roman Ovchinnikov <coolthecold@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/remote-helpers/git-remote-bzr | 14 ++++++++++----
 contrib/remote-helpers/git-remote-hg  | 14 ++++++++++----
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr
index 054161a..858ba3c 100755
--- a/contrib/remote-helpers/git-remote-bzr
+++ b/contrib/remote-helpers/git-remote-bzr
@@ -884,6 +884,16 @@ def main(args):
     global branches, peers
     global transports
 
+    marks = None
+    is_tmp = False
+    gitdir = os.environ.get('GIT_DIR', None)
+
+    if len(args) < 3:
+        die('Not enough arguments.')
+
+    if not gitdir:
+        die('GIT_DIR not set')
+
     alias = args[1]
     url = args[2]
 
@@ -892,7 +902,6 @@ def main(args):
     blob_marks = {}
     parsed_refs = {}
     files_cache = {}
-    marks = None
     branches = {}
     peers = {}
     transports = []
@@ -900,11 +909,8 @@ def main(args):
     if alias[5:] == url:
         is_tmp = True
         alias = hashlib.sha1(alias).hexdigest()
-    else:
-        is_tmp = False
 
     prefix = 'refs/bzr/%s' % alias
-    gitdir = os.environ['GIT_DIR']
     dirname = os.path.join(gitdir, 'bzr', alias)
 
     if not is_tmp:
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index a81d59e..aa1d230 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -1165,6 +1165,16 @@ def main(args):
     global dry_run
     global notes, alias
 
+    marks = None
+    is_tmp = False
+    gitdir = os.environ.get('GIT_DIR', None)
+
+    if len(args) < 3:
+        die('Not enough arguments.')
+
+    if not gitdir:
+        die('GIT_DIR not set')
+
     alias = args[1]
     url = args[2]
     peer = None
@@ -1185,16 +1195,12 @@ def main(args):
     if alias[4:] == url:
         is_tmp = True
         alias = hashlib.sha1(alias).hexdigest()
-    else:
-        is_tmp = False
 
-    gitdir = os.environ['GIT_DIR']
     dirname = os.path.join(gitdir, 'hg', alias)
     branches = {}
     bmarks = {}
     blob_marks = {}
     parsed_refs = {}
-    marks = None
     parsed_tags = {}
     filenodes = {}
     fake_bmark = None
-- 
1.8.4.2+fc1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/4] remote-hg: fix 'shared path' path
  2013-12-07 13:09 [PATCH 0/4] remote-helpers: fixes Felipe Contreras
  2013-12-07 13:09 ` [PATCH 1/4] remote-hg: avoid buggy strftime() Felipe Contreras
  2013-12-07 13:09 ` [PATCH 2/4] remote-helpers: add extra safety checks Felipe Contreras
@ 2013-12-07 13:09 ` Felipe Contreras
  2013-12-13 17:58   ` Antoine Pelisse
  2013-12-07 13:09 ` [PATCH 4/4] remote-hg: add tests for special filenames Felipe Contreras
  3 siblings, 1 reply; 8+ messages in thread
From: Felipe Contreras @ 2013-12-07 13:09 UTC (permalink / raw)
  To: git; +Cc: Felipe Contreras

If the repository is moved, the absolute path of the shared repository
would fail.

Make sure it's always up-to-date.

Reported-by: Michael Davis <mjmdavis@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/remote-helpers/git-remote-hg | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index aa1d230..718ef95 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -416,6 +416,9 @@ def get_repo(url, alias):
         local_path = os.path.join(dirname, 'clone')
         if not os.path.exists(local_path):
             hg.share(myui, shared_path, local_path, update=False)
+        else:
+            # make sure the shared path is always up-to-date
+            util.writefile(os.path.join(local_path, '.hg', 'sharedpath'), hg_path)
 
         repo = hg.repository(myui, local_path)
         try:
-- 
1.8.4.2+fc1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/4] remote-hg: add tests for special filenames
  2013-12-07 13:09 [PATCH 0/4] remote-helpers: fixes Felipe Contreras
                   ` (2 preceding siblings ...)
  2013-12-07 13:09 ` [PATCH 3/4] remote-hg: fix 'shared path' path Felipe Contreras
@ 2013-12-07 13:09 ` Felipe Contreras
  3 siblings, 0 replies; 8+ messages in thread
From: Felipe Contreras @ 2013-12-07 13:09 UTC (permalink / raw)
  To: git; +Cc: Felipe Contreras

So that we check that UTF-8 and spaces work fine.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/remote-helpers/test-hg.sh | 68 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh
index 72f745d..56840ff 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -442,6 +442,74 @@ test_expect_success 'remote new bookmark multiple branch head' '
 # cleanup previous stuff
 rm -rf hgrepo
 
+test_expect_success 'fetch special filenames' '
+	test_when_finished "rm -rf hgrepo gitrepo && LC_ALL=C" &&
+
+	LC_ALL=en_US.UTF-8
+	export LC_ALL
+
+	(
+	hg init hgrepo &&
+	cd hgrepo &&
+
+	echo test >> "æ rø" &&
+	hg add "æ rø" &&
+	echo test >> "ø~?" &&
+	hg add "ø~?" &&
+	hg commit -m add-utf-8 &&
+	echo test >> "æ rø" &&
+	hg commit -m test-utf-8 &&
+	hg rm "ø~?" &&
+	hg mv "æ rø" "ø~?" &&
+	hg commit -m hg-mv-utf-8
+	) &&
+
+	(
+	git clone "hg::hgrepo" gitrepo &&
+	cd gitrepo &&
+	git -c core.quotepath=false ls-files > ../actual
+	) &&
+	echo "ø~?" > expected &&
+	test_cmp expected actual
+'
+
+test_expect_success 'push special filenames' '
+	test_when_finished "rm -rf hgrepo gitrepo && LC_ALL=C" &&
+
+	mkdir -p tmp && cd tmp &&
+
+	LC_ALL=en_US.UTF-8
+	export LC_ALL
+
+	(
+	hg init hgrepo &&
+	cd hgrepo &&
+
+	echo one >> content &&
+	hg add content &&
+	hg commit -m one
+	) &&
+
+	(
+	git clone "hg::hgrepo" gitrepo &&
+	cd gitrepo &&
+
+	echo test >> "æ rø" &&
+	git add "æ rø" &&
+	git commit -m utf-8 &&
+
+	git push
+	) &&
+
+	(cd hgrepo &&
+	hg update &&
+	hg manifest > ../actual
+	) &&
+
+	printf "content\næ rø\n" > expected &&
+	test_cmp expected actual
+'
+
 setup_big_push () {
 	(
 	hg init hgrepo &&
-- 
1.8.4.2+fc1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] remote-hg: fix 'shared path' path
  2013-12-07 13:09 ` [PATCH 3/4] remote-hg: fix 'shared path' path Felipe Contreras
@ 2013-12-13 17:58   ` Antoine Pelisse
  2013-12-17 22:25     ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Antoine Pelisse @ 2013-12-13 17:58 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: git

On Sat, Dec 7, 2013 at 2:09 PM, Felipe Contreras
<felipe.contreras@gmail.com> wrote:
> If the repository is moved, the absolute path of the shared repository
> would fail.
>
> Make sure it's always up-to-date.
>
> Reported-by: Michael Davis <mjmdavis@gmail.com>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  contrib/remote-helpers/git-remote-hg | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
> index aa1d230..718ef95 100755
> --- a/contrib/remote-helpers/git-remote-hg
> +++ b/contrib/remote-helpers/git-remote-hg
> @@ -416,6 +416,9 @@ def get_repo(url, alias):
>          local_path = os.path.join(dirname, 'clone')
>          if not os.path.exists(local_path):
>              hg.share(myui, shared_path, local_path, update=False)
> +        else:
> +            # make sure the shared path is always up-to-date
> +            util.writefile(os.path.join(local_path, '.hg', 'sharedpath'), hg_path)

Considering this is modifying a "private mercurial file", would it
make sense to include a test like I did in my equivalent patch ?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] remote-hg: fix 'shared path' path
  2013-12-13 17:58   ` Antoine Pelisse
@ 2013-12-17 22:25     ` Junio C Hamano
  2013-12-23 20:23       ` [PATCH] remote-hg: test 'shared_path' in a moved clone Antoine Pelisse
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2013-12-17 22:25 UTC (permalink / raw)
  To: Antoine Pelisse; +Cc: Felipe Contreras, git

Antoine Pelisse <apelisse@gmail.com> writes:

> On Sat, Dec 7, 2013 at 2:09 PM, Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
>> If the repository is moved, the absolute path of the shared repository
>> would fail.
>>
>> Make sure it's always up-to-date.
>>
>> Reported-by: Michael Davis <mjmdavis@gmail.com>
>> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
>> ---
>>  contrib/remote-helpers/git-remote-hg | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
>> index aa1d230..718ef95 100755
>> --- a/contrib/remote-helpers/git-remote-hg
>> +++ b/contrib/remote-helpers/git-remote-hg
>> @@ -416,6 +416,9 @@ def get_repo(url, alias):
>>          local_path = os.path.join(dirname, 'clone')
>>          if not os.path.exists(local_path):
>>              hg.share(myui, shared_path, local_path, update=False)
>> +        else:
>> +            # make sure the shared path is always up-to-date
>> +            util.writefile(os.path.join(local_path, '.hg', 'sharedpath'), hg_path)
>
> Considering this is modifying a "private mercurial file", would it
> make sense to include a test like I did in my equivalent patch ?

Hmph. I was planning to merge the topic to 'next' today; perhaps the
necessary tests can come as a follow-up patch on top of the topic
before it graduates to 'master'?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] remote-hg: test 'shared_path' in a moved clone
  2013-12-17 22:25     ` Junio C Hamano
@ 2013-12-23 20:23       ` Antoine Pelisse
  0 siblings, 0 replies; 8+ messages in thread
From: Antoine Pelisse @ 2013-12-23 20:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Felipe Contreras, git, Antoine Pelisse

Since e71d1378 (remote-hg: fix 'shared path' path, 2013-12-07),
Mercurial 'shared_path' file is correctly updated whenever a clone is
moved. Make sure it keeps working, especially as this is depending on a
private Mercurial file.

Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
---
 contrib/remote-helpers/test-hg.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh
index 0b7df11..5d128a5 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -337,6 +337,17 @@ test_expect_success 'remote cloning' '
 	check gitrepo HEAD zero
 '
 
+test_expect_success 'moving remote clone' '
+	test_when_finished "rm -rf gitrepo*" &&
+
+	(
+	git clone "hg::hgrepo" gitrepo &&
+	mv gitrepo gitrepo2 &&
+	cd gitrepo2 &&
+	git fetch
+	)
+'
+
 test_expect_success 'remote update bookmark' '
 	test_when_finished "rm -rf gitrepo*" &&
 
-- 
1.8.5.1.97.g8d784da.dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-12-23 20:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-07 13:09 [PATCH 0/4] remote-helpers: fixes Felipe Contreras
2013-12-07 13:09 ` [PATCH 1/4] remote-hg: avoid buggy strftime() Felipe Contreras
2013-12-07 13:09 ` [PATCH 2/4] remote-helpers: add extra safety checks Felipe Contreras
2013-12-07 13:09 ` [PATCH 3/4] remote-hg: fix 'shared path' path Felipe Contreras
2013-12-13 17:58   ` Antoine Pelisse
2013-12-17 22:25     ` Junio C Hamano
2013-12-23 20:23       ` [PATCH] remote-hg: test 'shared_path' in a moved clone Antoine Pelisse
2013-12-07 13:09 ` [PATCH 4/4] remote-hg: add tests for special filenames Felipe Contreras

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.