3 from git_remote_helpers
.util
import die
, warn
5 class NonLocalHg(object):
6 def __init__(self
, repo
):
10 def clone(self
, base
):
11 path
= self
.repo
.get_base_path(base
)
14 if os
.path
.exists(os
.path
.join(path
, '.hg')):
17 if not os
.path
.exists(path
):
20 if self
.repo
.path
.endswith(".hg"):
21 from_path
= self
.repo
.path
[:-3]
23 from_path
= self
.repo
.path
25 self
.repo
.ui
.setconfig('ui', 'quiet', "true")
26 self
.hg
.clone(self
.repo
.ui
, {}, from_path
, path
, update
=False, pull
=True)
30 def update(self
, base
):
31 path
= self
.repo
.get_base_path(base
)
33 if not os
.path
.exists(path
):
34 die("could not find repo at %s", path
)
36 repo
= self
.hg
.repository(self
.repo
.ui
, path
)
38 repo
.ui
.setconfig('ui', 'quiet', "true")
39 repo
.pull(self
.repo
, heads
=self
.repo
.heads(), force
=True)
42 path
= self
.repo
.get_base_path(base
)
44 if not os
.path
.exists(path
):
45 die("could not find repo at %s", path
)
47 repo
= self
.hg
.repository(self
.repo
.ui
, path
)
49 self
.repo
.ui
.setconfig('ui', 'quiet', "true")
50 repo
.ui
.setconfig('ui', 'quiet', "true")
51 repo
.push(self
.repo
, force
=False)