equal
deleted
inserted
replaced
67 |
67 |
68 def defaultdest(source): |
68 def defaultdest(source): |
69 '''return default destination of clone if none is given''' |
69 '''return default destination of clone if none is given''' |
70 return os.path.basename(os.path.normpath(source)) |
70 return os.path.basename(os.path.normpath(source)) |
71 |
71 |
|
72 def localpath(path): |
|
73 if path.startswith('file://localhost/'): |
|
74 return path[16:] |
|
75 if path.startswith('file://'): |
|
76 return path[7:] |
|
77 if path.startswith('file:'): |
|
78 return path[5:] |
|
79 return path |
|
80 |
72 def clone(ui, source, dest=None, pull=False, rev=None, update=True, |
81 def clone(ui, source, dest=None, pull=False, rev=None, update=True, |
73 stream=False): |
82 stream=False): |
74 """Make a copy of an existing repository. |
83 """Make a copy of an existing repository. |
75 |
84 |
76 Create a copy of an existing repository in a new directory. The |
85 Create a copy of an existing repository in a new directory. The |
113 checkout = None |
122 checkout = None |
114 |
123 |
115 if dest is None: |
124 if dest is None: |
116 dest = defaultdest(source) |
125 dest = defaultdest(source) |
117 ui.status(_("destination directory: %s\n") % dest) |
126 ui.status(_("destination directory: %s\n") % dest) |
118 |
|
119 def localpath(path): |
|
120 if path.startswith('file://localhost/'): |
|
121 return path[16:] |
|
122 if path.startswith('file://'): |
|
123 return path[7:] |
|
124 if path.startswith('file:'): |
|
125 return path[5:] |
|
126 return path |
|
127 |
127 |
128 dest = localpath(dest) |
128 dest = localpath(dest) |
129 source = localpath(source) |
129 source = localpath(source) |
130 |
130 |
131 if os.path.exists(dest): |
131 if os.path.exists(dest): |