Mercurial > hg
comparison hgext/mq.py @ 15878:914b013d3263
mq: minor cleanup
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Wed, 11 Jan 2012 02:28:12 +0100 |
parents | bfd3ce759682 |
children | 710e6bf15538 |
comparison
equal
deleted
inserted
replaced
15877:afd459933d5f | 15878:914b013d3263 |
---|---|
305 raise | 305 raise |
306 | 306 |
307 @util.propertycache | 307 @util.propertycache |
308 def fullseries(self): | 308 def fullseries(self): |
309 try: | 309 try: |
310 return self.opener.read(self.seriespath).splitlines() | 310 return self.opener.read(self.seriespath).splitlines() |
311 except IOError, e: | 311 except IOError, e: |
312 if e.errno == errno.ENOENT: | 312 if e.errno == errno.ENOENT: |
313 return [] | 313 return [] |
314 raise | 314 raise |
315 | 315 |
2314 | 2314 |
2315 The header for each folded patch will be concatenated with the | 2315 The header for each folded patch will be concatenated with the |
2316 current patch header, separated by a line of ``* * *``. | 2316 current patch header, separated by a line of ``* * *``. |
2317 | 2317 |
2318 Returns 0 on success.""" | 2318 Returns 0 on success.""" |
2319 | |
2320 q = repo.mq | 2319 q = repo.mq |
2321 | |
2322 if not files: | 2320 if not files: |
2323 raise util.Abort(_('qfold requires at least one patch name')) | 2321 raise util.Abort(_('qfold requires at least one patch name')) |
2324 if not q.checktoppatch(repo)[0]: | 2322 if not q.checktoppatch(repo)[0]: |
2325 raise util.Abort(_('no patches applied')) | 2323 raise util.Abort(_('no patches applied')) |
2326 q.checklocalchanges(repo) | 2324 q.checklocalchanges(repo) |
2529 else: | 2527 else: |
2530 newpath, i = lastsavename(q.path) | 2528 newpath, i = lastsavename(q.path) |
2531 if not newpath: | 2529 if not newpath: |
2532 ui.warn(_("no saved queues found, please use -n\n")) | 2530 ui.warn(_("no saved queues found, please use -n\n")) |
2533 return 1 | 2531 return 1 |
2534 mergeq = queue(ui, repo.join(""), newpath) | 2532 mergeq = queue(ui, repo.path, newpath) |
2535 ui.warn(_("merging with queue at: %s\n") % mergeq.path) | 2533 ui.warn(_("merging with queue at: %s\n") % mergeq.path) |
2536 ret = q.push(repo, patch, force=opts.get('force'), list=opts.get('list'), | 2534 ret = q.push(repo, patch, force=opts.get('force'), list=opts.get('list'), |
2537 mergeq=mergeq, all=opts.get('all'), move=opts.get('move'), | 2535 mergeq=mergeq, all=opts.get('all'), move=opts.get('move'), |
2538 exact=opts.get('exact')) | 2536 exact=opts.get('exact')) |
2539 return ret | 2537 return ret |
2553 | 2551 |
2554 Return 0 on success. | 2552 Return 0 on success. |
2555 """ | 2553 """ |
2556 localupdate = True | 2554 localupdate = True |
2557 if opts.get('name'): | 2555 if opts.get('name'): |
2558 q = queue(ui, repo.join(""), repo.join(opts.get('name'))) | 2556 q = queue(ui, repo.path, repo.join(opts.get('name'))) |
2559 ui.warn(_('using patch queue: %s\n') % q.path) | 2557 ui.warn(_('using patch queue: %s\n') % q.path) |
2560 localupdate = False | 2558 localupdate = False |
2561 else: | 2559 else: |
2562 q = repo.mq | 2560 q = repo.mq |
2563 ret = q.pop(repo, patch, force=opts.get('force'), update=localupdate, | 2561 ret = q.pop(repo, patch, force=opts.get('force'), update=localupdate, |
2571 | 2569 |
2572 With one argument, renames the current patch to PATCH1. | 2570 With one argument, renames the current patch to PATCH1. |
2573 With two arguments, renames PATCH1 to PATCH2. | 2571 With two arguments, renames PATCH1 to PATCH2. |
2574 | 2572 |
2575 Returns 0 on success.""" | 2573 Returns 0 on success.""" |
2576 | |
2577 q = repo.mq | 2574 q = repo.mq |
2578 | |
2579 if not name: | 2575 if not name: |
2580 name = patch | 2576 name = patch |
2581 patch = None | 2577 patch = None |
2582 | 2578 |
2583 if patch: | 2579 if patch: |
2954 To delete an existing queue, use --delete. You cannot delete the currently | 2950 To delete an existing queue, use --delete. You cannot delete the currently |
2955 active queue. | 2951 active queue. |
2956 | 2952 |
2957 Returns 0 on success. | 2953 Returns 0 on success. |
2958 ''' | 2954 ''' |
2959 | |
2960 q = repo.mq | 2955 q = repo.mq |
2961 | |
2962 _defaultqueue = 'patches' | 2956 _defaultqueue = 'patches' |
2963 _allqueues = 'patches.queues' | 2957 _allqueues = 'patches.queues' |
2964 _activequeue = 'patches.queue' | 2958 _activequeue = 'patches.queue' |
2965 | 2959 |
2966 def _getcurrent(): | 2960 def _getcurrent(): |
3103 | 3097 |
3104 def reposetup(ui, repo): | 3098 def reposetup(ui, repo): |
3105 class mqrepo(repo.__class__): | 3099 class mqrepo(repo.__class__): |
3106 @util.propertycache | 3100 @util.propertycache |
3107 def mq(self): | 3101 def mq(self): |
3108 return queue(self.ui, self.join("")) | 3102 return queue(self.ui, self.path) |
3109 | 3103 |
3110 def abortifwdirpatched(self, errmsg, force=False): | 3104 def abortifwdirpatched(self, errmsg, force=False): |
3111 if self.mq.applied and not force: | 3105 if self.mq.applied and not force: |
3112 parents = self.dirstate.parents() | 3106 parents = self.dirstate.parents() |
3113 patches = [s.node for s in self.mq.applied] | 3107 patches = [s.node for s in self.mq.applied] |