Re: [PATCH 3/4] remote-hg: fix 'shared path' path

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 3/4] remote-hg: fix 'shared path' path

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:59:28

Antoine Pelisse [off-list ref] writes:
On Sat, Dec 7, 2013 at 2:09 PM, Felipe Contreras
[off-list ref] wrote:
quoted
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 <redacted>
Signed-off-by: Felipe Contreras <redacted>
---
 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'?

[PATCH] remote-hg: test 'shared_path' in a moved clone

From: Antoine Pelisse <hidden>
Date: 2016-06-15 22:59:30

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help