224 |
224 |
225 def hg_setup( |
225 def hg_setup( |
226 remote: String, |
226 remote: String, |
227 local_path: Path, |
227 local_path: Path, |
228 remote_name: String = "", |
228 remote_name: String = "", |
229 pull_source: String = "", |
|
230 path_name: String = default_path_name, |
229 path_name: String = default_path_name, |
231 progress: Progress = No_Progress) |
230 progress: Progress = No_Progress) |
232 { |
231 { |
233 /* local repository */ |
232 /* local repository */ |
234 |
233 |
279 |
278 |
280 /* synchronize local and remote state */ |
279 /* synchronize local and remote state */ |
281 |
280 |
282 progress.echo("Synchronizing ...") |
281 progress.echo("Synchronizing ...") |
283 |
282 |
284 if (pull_source.nonEmpty) local_hg.pull(remote = pull_source) |
|
285 |
|
286 edit_hgrc(local_hg, path_name, remote_url) |
283 edit_hgrc(local_hg, path_name, remote_url) |
287 |
284 |
288 local_hg.pull(options = "-u") |
285 local_hg.pull(options = "-u") |
289 |
286 |
290 local_hg.push(remote = remote_url) |
287 local_hg.push(remote = remote_url) |
291 } |
288 } |
292 |
289 |
293 val isabelle_tool = |
290 val isabelle_tool = |
294 Isabelle_Tool("hg_setup", "setup remote vs. local Mercurial repository", args => |
291 Isabelle_Tool("hg_setup", "setup remote vs. local Mercurial repository", args => |
295 { |
292 { |
296 var pull_source = "" |
|
297 var remote_name = "" |
293 var remote_name = "" |
298 var path_name = default_path_name |
294 var path_name = default_path_name |
299 |
295 |
300 val getopts = Getopts(""" |
296 val getopts = Getopts(""" |
301 Usage: isabelle hg_setup [OPTIONS] REMOTE LOCAL |
297 Usage: isabelle hg_setup [OPTIONS] REMOTE LOCAL |
302 |
298 |
303 Options are: |
299 Options are: |
304 -P SOURCE pull local repository from existing source |
|
305 -n NAME remote repository name (default: base name of LOCAL directory) |
300 -n NAME remote repository name (default: base name of LOCAL directory) |
306 -p PATH Mercurial path name (default: """ + quote(default_path_name) + """) |
301 -p PATH Mercurial path name (default: """ + quote(default_path_name) + """) |
307 |
302 |
308 Setup a remote vs. local Mercurial repository: REMOTE either refers to a |
303 Setup a remote vs. local Mercurial repository: REMOTE either refers to a |
309 Phabricator server "user@host" or SSH file server "ssh://user@host/path". |
304 Phabricator server "user@host" or SSH file server "ssh://user@host/path". |
310 Both the remote and local repository are initialized on demand. |
305 Both the remote and local repository are initialized on demand. |
311 """, |
306 """, |
312 "P" -> (arg => pull_source = arg), |
|
313 "n:" -> (arg => remote_name = arg), |
307 "n:" -> (arg => remote_name = arg), |
314 "p:" -> (arg => path_name = arg)) |
308 "p:" -> (arg => path_name = arg)) |
315 |
309 |
316 val more_args = getopts(args) |
310 val more_args = getopts(args) |
317 |
311 |
321 case _ => getopts.usage() |
315 case _ => getopts.usage() |
322 } |
316 } |
323 |
317 |
324 val progress = new Console_Progress |
318 val progress = new Console_Progress |
325 |
319 |
326 hg_setup(remote, local_path, remote_name = remote_name, pull_source = pull_source, |
320 hg_setup(remote, local_path, remote_name = remote_name, path_name = path_name, |
327 path_name = path_name, progress = progress) |
321 progress = progress) |
328 }) |
322 }) |
329 } |
323 } |