Show More
@@ -38,7 +38,8 b' versionstr = "0.45"' | |||
|
38 | 38 | |
|
39 | 39 | repomap = {} |
|
40 | 40 | |
|
41 | commands.norepo += " qversion" | |
|
41 | commands.norepo += " qclone qversion" | |
|
42 | ||
|
42 | 43 | class queue: |
|
43 | 44 | def __init__(self, ui, path, patchdir=None): |
|
44 | 45 | self.basepath = path |
@@ -1177,6 +1178,52 b' def init(ui, repo, **opts):' | |||
|
1177 | 1178 | r.add(['.hgignore', 'series']) |
|
1178 | 1179 | return 0 |
|
1179 | 1180 | |
|
1181 | def clone(ui, source, dest=None, **opts): | |
|
1182 | '''clone main and patch repository at same time | |
|
1183 | ||
|
1184 | If source is local, destination will have no patches applied. If | |
|
1185 | source is remote, this command can not check if patches are | |
|
1186 | applied in source, so cannot guarantee that patches are not | |
|
1187 | applied in destination. If you clone remote repository, be sure | |
|
1188 | before that it has no patches applied. | |
|
1189 | ||
|
1190 | Source patch repository is looked for in <src>/.hg/patches by | |
|
1191 | default. Use -p <url> to change. | |
|
1192 | ''' | |
|
1193 | ui.setconfig_remoteopts(**opts) | |
|
1194 | if dest is None: | |
|
1195 | dest = hg.defaultdest(source) | |
|
1196 | sr = hg.repository(ui, ui.expandpath(source)) | |
|
1197 | qbase, destrev = None, None | |
|
1198 | if sr.local(): | |
|
1199 | reposetup(ui, sr) | |
|
1200 | sq = repomap[sr] | |
|
1201 | if sq.applied: | |
|
1202 | qbase = revlog.bin(sq.applied[0].split(':')[0]) | |
|
1203 | if not hg.islocal(dest): | |
|
1204 | destrev = sr.parents(qbase)[0] | |
|
1205 | ui.note(_('cloning main repo\n')) | |
|
1206 | sr, dr = hg.clone(ui, sr, dest, | |
|
1207 | pull=opts['pull'], | |
|
1208 | rev=destrev, | |
|
1209 | update=False, | |
|
1210 | stream=opts['uncompressed']) | |
|
1211 | ui.note(_('cloning patch repo\n')) | |
|
1212 | spr, dpr = hg.clone(ui, opts['patches'] or (sr.url() + '/.hg/patches'), | |
|
1213 | dr.url() + '/.hg/patches', | |
|
1214 | pull=opts['pull'], | |
|
1215 | update=not opts['noupdate'], | |
|
1216 | stream=opts['uncompressed']) | |
|
1217 | if dr.local(): | |
|
1218 | if qbase: | |
|
1219 | ui.note(_('stripping applied patches from destination repo\n')) | |
|
1220 | reposetup(ui, dr) | |
|
1221 | dq = repomap[dr] | |
|
1222 | dq.strip(dr, qbase, update=False, backup=None) | |
|
1223 | if not opts['noupdate']: | |
|
1224 | ui.note(_('updating destination repo\n')) | |
|
1225 | dr.update(dr.changelog.tip()) | |
|
1226 | ||
|
1180 | 1227 | def commit(ui, repo, *pats, **opts): |
|
1181 | 1228 | """commit changes in the queue repository""" |
|
1182 | 1229 | q = repomap[repo] |
@@ -1369,6 +1416,16 b' def reposetup(ui, repo):' | |||
|
1369 | 1416 | |
|
1370 | 1417 | cmdtable = { |
|
1371 | 1418 | "qapplied": (applied, [], 'hg qapplied [PATCH]'), |
|
1419 | "qclone": (clone, | |
|
1420 | [('', 'pull', None, _('use pull protocol to copy metadata')), | |
|
1421 | ('U', 'noupdate', None, _('do not update the new working directories')), | |
|
1422 | ('', 'uncompressed', None, | |
|
1423 | _('use uncompressed transfer (fast over LAN)')), | |
|
1424 | ('e', 'ssh', '', _('specify ssh command to use')), | |
|
1425 | ('p', 'patches', '', _('location of source patch repo')), | |
|
1426 | ('', 'remotecmd', '', | |
|
1427 | _('specify hg command to run on the remote side'))], | |
|
1428 | 'hg qclone [OPTION]... SOURCE [DEST]'), | |
|
1372 | 1429 | "qcommit|qci": |
|
1373 | 1430 | (commit, |
|
1374 | 1431 | commands.table["^commit|ci"][1], |
General Comments 0
You need to be logged in to leave comments.
Login now