Show More
@@ -1276,39 +1276,40 b' class queue:' | |||
|
1276 | 1276 | self.ui.write("No patches applied\n") |
|
1277 | 1277 | return 1 |
|
1278 | 1278 | |
|
1279 | def qimport(self, repo, files, patch=None, existing=None, force=None): | |
|
1280 | if len(files) > 1 and patch: | |
|
1279 | def qimport(self, repo, files, patchname=None, existing=None, force=None): | |
|
1280 | if len(files) > 1 and patchname: | |
|
1281 | 1281 | raise util.Abort(_('option "-n" not valid when importing multiple ' |
|
1282 | 1282 | 'files')) |
|
1283 | 1283 | i = 0 |
|
1284 | 1284 | added = [] |
|
1285 | 1285 | for filename in files: |
|
1286 | 1286 | if existing: |
|
1287 | if not patch: | |
|
1288 | patch = filename | |
|
1289 | if not os.path.isfile(self.join(patch)): | |
|
1290 | raise util.Abort(_("patch %s does not exist") % patch) | |
|
1287 | if not patchname: | |
|
1288 | patchname = filename | |
|
1289 | if not os.path.isfile(self.join(patchname)): | |
|
1290 | raise util.Abort(_("patch %s does not exist") % patchname) | |
|
1291 | 1291 | else: |
|
1292 | 1292 | try: |
|
1293 | 1293 | text = file(filename).read() |
|
1294 | 1294 | except IOError: |
|
1295 | raise util.Abort(_("unable to read %s") % patch) | |
|
1296 | if not patch: | |
|
1297 |
patch = os.path. |
|
|
1298 | if not force and os.path.exists(self.join(patch)): | |
|
1299 |
raise util.Abort(_('patch "%s" already exists') |
|
|
1300 | patchf = self.opener(patch, "w") | |
|
1295 | raise util.Abort(_("unable to read %s") % patchname) | |
|
1296 | if not patchname: | |
|
1297 | patchname = os.path.basename(filename) | |
|
1298 | if not force and os.path.exists(self.join(patchname)): | |
|
1299 | raise util.Abort(_('patch "%s" already exists') | |
|
1300 | % patchname) | |
|
1301 | patchf = self.opener(patchname, "w") | |
|
1301 | 1302 | patchf.write(text) |
|
1302 | if patch in self.series: | |
|
1303 | if patchname in self.series: | |
|
1303 | 1304 | raise util.Abort(_('patch %s is already in the series file') |
|
1304 | % patch) | |
|
1305 | % patchname) | |
|
1305 | 1306 | index = self.full_series_end() + i |
|
1306 | self.full_series[index:index] = [patch] | |
|
1307 | self.full_series[index:index] = [patchname] | |
|
1307 | 1308 | self.parse_series() |
|
1308 | self.ui.warn("adding %s to series file\n" % patch) | |
|
1309 | self.ui.warn("adding %s to series file\n" % patchname) | |
|
1309 | 1310 | i += 1 |
|
1310 | added.append(patch) | |
|
1311 | patch = None | |
|
1311 | added.append(patchname) | |
|
1312 | patchname = None | |
|
1312 | 1313 | self.series_dirty = 1 |
|
1313 | 1314 | qrepo = self.qrepo() |
|
1314 | 1315 | if qrepo: |
@@ -1344,7 +1345,7 b' def unapplied(ui, repo, patch=None, **op' | |||
|
1344 | 1345 | def qimport(ui, repo, *filename, **opts): |
|
1345 | 1346 | """import a patch""" |
|
1346 | 1347 | q = repo.mq |
|
1347 | q.qimport(repo, filename, patch=opts['name'], | |
|
1348 | q.qimport(repo, filename, patchname=opts['name'], | |
|
1348 | 1349 | existing=opts['existing'], force=opts['force']) |
|
1349 | 1350 | q.save_dirty() |
|
1350 | 1351 | return 0 |
General Comments 0
You need to be logged in to leave comments.
Login now