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