12 import os, stat |
12 import os, stat |
13 |
13 |
14 def relink(ui, repo, origin=None, **opts): |
14 def relink(ui, repo, origin=None, **opts): |
15 """recreate hardlinks between two repositories |
15 """recreate hardlinks between two repositories |
16 |
16 |
17 When repositories are cloned locally, their data files will be hardlinked |
17 When repositories are cloned locally, their data files will be |
18 so that they only use the space of a single repository. |
18 hardlinked so that they only use the space of a single repository. |
19 |
19 |
20 Unfortunately, subsequent pulls into either repository will break hardlinks |
20 Unfortunately, subsequent pulls into either repository will break |
21 for any files touched by the new changesets, even if both repositories end |
21 hardlinks for any files touched by the new changesets, even if |
22 up pulling the same changes. |
22 both repositories end up pulling the same changes. |
23 |
23 |
24 Similarly, passing --rev to "hg clone" will fail to use |
24 Similarly, passing --rev to "hg clone" will fail to use any |
25 any hardlinks, falling back to a complete copy of the source repository. |
25 hardlinks, falling back to a complete copy of the source |
|
26 repository. |
26 |
27 |
27 This command lets you recreate those hardlinks and reclaim that wasted |
28 This command lets you recreate those hardlinks and reclaim that |
28 space. |
29 wasted space. |
29 |
30 |
30 This repository will be relinked to share space with ORIGIN, which must be |
31 This repository will be relinked to share space with ORIGIN, which |
31 on the same local disk. If ORIGIN is omitted, looks for "default-relink", |
32 must be on the same local disk. If ORIGIN is omitted, looks for |
32 then "default", in [paths]. |
33 "default-relink", then "default", in [paths]. |
33 |
34 |
34 Do not attempt any read operations on this repository while the command is |
35 Do not attempt any read operations on this repository while the |
35 running. (Both repositories will be locked against writes.) |
36 command is running. (Both repositories will be locked against |
|
37 writes.) |
36 """ |
38 """ |
37 src = hg.repository( |
39 src = hg.repository( |
38 cmdutil.remoteui(repo, opts), |
40 cmdutil.remoteui(repo, opts), |
39 ui.expandpath(origin or 'default-relink', origin or 'default')) |
41 ui.expandpath(origin or 'default-relink', origin or 'default')) |
40 if not src.local(): |
42 if not src.local(): |