##// END OF EJS Templates
transplant: wrapped long lines
Martin Geisler -
r7744:b44dbb95 default
parent child Browse files
Show More
@@ -69,7 +69,8 b' class transplanter:'
69 self.ui = ui
69 self.ui = ui
70 self.path = repo.join('transplant')
70 self.path = repo.join('transplant')
71 self.opener = util.opener(self.path)
71 self.opener = util.opener(self.path)
72 self.transplants = transplants(self.path, 'transplants', opener=self.opener)
72 self.transplants = transplants(self.path, 'transplants',
73 opener=self.opener)
73
74
74 def applied(self, repo, node, parent):
75 def applied(self, repo, node, parent):
75 '''returns True if a node is already an ancestor of parent
76 '''returns True if a node is already an ancestor of parent
@@ -109,8 +110,8 b' class transplanter:'
109
110
110 parents = source.changelog.parents(node)
111 parents = source.changelog.parents(node)
111 if not opts.get('filter'):
112 if not opts.get('filter'):
112 # If the changeset parent is the same as the wdir's parent,
113 # If the changeset parent is the same as the
113 # just pull it.
114 # wdir's parent, just pull it.
114 if parents[0] == p1:
115 if parents[0] == p1:
115 pulls.append(node)
116 pulls.append(node)
116 p1 = node
117 p1 = node
@@ -124,9 +125,9 b' class transplanter:'
124
125
125 domerge = False
126 domerge = False
126 if node in merges:
127 if node in merges:
127 # pulling all the merge revs at once would mean we couldn't
128 # pulling all the merge revs at once would mean we
128 # transplant after the latest even if transplants before them
129 # couldn't transplant after the latest even if
129 # fail.
130 # transplants before them fail.
130 domerge = True
131 domerge = True
131 if not hasnode(repo, node):
132 if not hasnode(repo, node):
132 repo.pull(source, heads=[node])
133 repo.pull(source, heads=[node])
@@ -155,8 +156,9 b' class transplanter:'
155 self.ui.status(_('%s merged at %s\n') % (revstr,
156 self.ui.status(_('%s merged at %s\n') % (revstr,
156 revlog.short(n)))
157 revlog.short(n)))
157 elif n:
158 elif n:
158 self.ui.status(_('%s transplanted to %s\n') % (revlog.short(node),
159 self.ui.status(_('%s transplanted to %s\n')
159 revlog.short(n)))
160 % (revlog.short(node),
161 revlog.short(n)))
160 finally:
162 finally:
161 if patchfile:
163 if patchfile:
162 os.unlink(patchfile)
164 os.unlink(patchfile)
@@ -217,7 +219,8 b' class transplanter:'
217 fuzz = patch.patch(patchfile, self.ui, cwd=repo.root,
219 fuzz = patch.patch(patchfile, self.ui, cwd=repo.root,
218 files=files)
220 files=files)
219 if not files:
221 if not files:
220 self.ui.warn(_('%s: empty changeset') % revlog.hex(node))
222 self.ui.warn(_('%s: empty changeset')
223 % revlog.hex(node))
221 return None
224 return None
222 finally:
225 finally:
223 files = patch.updatedir(self.ui, repo, files)
226 files = patch.updatedir(self.ui, repo, files)
@@ -231,7 +234,8 b' class transplanter:'
231 p2 = node
234 p2 = node
232 self.log(user, date, message, p1, p2, merge=merge)
235 self.log(user, date, message, p1, p2, merge=merge)
233 self.ui.write(str(inst) + '\n')
236 self.ui.write(str(inst) + '\n')
234 raise util.Abort(_('Fix up the merge and run hg transplant --continue'))
237 raise util.Abort(_('Fix up the merge and run '
238 'hg transplant --continue'))
235 else:
239 else:
236 files = None
240 files = None
237 if merge:
241 if merge:
@@ -496,16 +500,19 b' def transplant(ui, repo, *revs, **opts):'
496 def checkopts(opts, revs):
500 def checkopts(opts, revs):
497 if opts.get('continue'):
501 if opts.get('continue'):
498 if filter(lambda opt: opts.get(opt), ('branch', 'all', 'merge')):
502 if filter(lambda opt: opts.get(opt), ('branch', 'all', 'merge')):
499 raise util.Abort(_('--continue is incompatible with branch, all or merge'))
503 raise util.Abort(_('--continue is incompatible with '
504 'branch, all or merge'))
500 return
505 return
501 if not (opts.get('source') or revs or
506 if not (opts.get('source') or revs or
502 opts.get('merge') or opts.get('branch')):
507 opts.get('merge') or opts.get('branch')):
503 raise util.Abort(_('no source URL, branch tag or revision list provided'))
508 raise util.Abort(_('no source URL, branch tag or revision '
509 'list provided'))
504 if opts.get('all'):
510 if opts.get('all'):
505 if not opts.get('branch'):
511 if not opts.get('branch'):
506 raise util.Abort(_('--all requires a branch revision'))
512 raise util.Abort(_('--all requires a branch revision'))
507 if revs:
513 if revs:
508 raise util.Abort(_('--all is incompatible with a revision list'))
514 raise util.Abort(_('--all is incompatible with a '
515 'revision list'))
509
516
510 checkopts(opts, revs)
517 checkopts(opts, revs)
511
518
@@ -553,9 +560,11 b' def transplant(ui, repo, *revs, **opts):'
553 revmap[int(r)] = source.lookup(r)
560 revmap[int(r)] = source.lookup(r)
554 elif opts.get('all') or not merges:
561 elif opts.get('all') or not merges:
555 if source != repo:
562 if source != repo:
556 alltransplants = incwalk(source, incoming, branches, match=matchfn)
563 alltransplants = incwalk(source, incoming, branches,
564 match=matchfn)
557 else:
565 else:
558 alltransplants = transplantwalk(source, p1, branches, match=matchfn)
566 alltransplants = transplantwalk(source, p1, branches,
567 match=matchfn)
559 if opts.get('all'):
568 if opts.get('all'):
560 revs = alltransplants
569 revs = alltransplants
561 else:
570 else:
@@ -581,7 +590,9 b' cmdtable = {'
581 ('p', 'prune', [], _('skip over REV')),
590 ('p', 'prune', [], _('skip over REV')),
582 ('m', 'merge', [], _('merge at REV')),
591 ('m', 'merge', [], _('merge at REV')),
583 ('', 'log', None, _('append transplant info to log message')),
592 ('', 'log', None, _('append transplant info to log message')),
584 ('c', 'continue', None, _('continue last transplant session after repair')),
593 ('c', 'continue', None, _('continue last transplant session '
594 'after repair')),
585 ('', 'filter', '', _('filter changesets through FILTER'))],
595 ('', 'filter', '', _('filter changesets through FILTER'))],
586 _('hg transplant [-s REPOSITORY] [-b BRANCH [-a]] [-p REV] [-m REV] [REV]...'))
596 _('hg transplant [-s REPOSITORY] [-b BRANCH [-a]] [-p REV] '
597 '[-m REV] [REV]...'))
587 }
598 }
General Comments 0
You need to be logged in to leave comments. Login now