Mercurial > hg > mercurial-crew-with-dirclash
comparison hgext/mq.py @ 2799:b550cd82f92a
Move merge code to its own module
Pull update and merge3 out of localrepo into merge.py
s/self/repo/
Add temporary API function in hg.py
Convert all users
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 03 Aug 2006 15:24:41 -0500 |
parents | 4720e79486d3 |
children | 987c31e2a08c |
comparison
equal
deleted
inserted
replaced
2798:8cd3e19bf4a5 | 2799:b550cd82f92a |
---|---|
177 raise util.Abort(_("apply failed for patch %s") % patch) | 177 raise util.Abort(_("apply failed for patch %s") % patch) |
178 | 178 |
179 self.ui.warn("patch didn't work out, merging %s\n" % patch) | 179 self.ui.warn("patch didn't work out, merging %s\n" % patch) |
180 | 180 |
181 # apply failed, strip away that rev and merge. | 181 # apply failed, strip away that rev and merge. |
182 repo.update(head, allow=False, force=True, wlock=wlock) | 182 hg.update(repo, head, allow=False, force=True, wlock=wlock) |
183 self.strip(repo, n, update=False, backup='strip', wlock=wlock) | 183 self.strip(repo, n, update=False, backup='strip', wlock=wlock) |
184 | 184 |
185 c = repo.changelog.read(rev) | 185 c = repo.changelog.read(rev) |
186 ret = repo.update(rev, allow=True, wlock=wlock) | 186 ret = hg.update(repo, rev, allow=True, wlock=wlock) |
187 if ret: | 187 if ret: |
188 raise util.Abort(_("update returned %d") % ret) | 188 raise util.Abort(_("update returned %d") % ret) |
189 n = repo.commit(None, c[4], c[1], force=1, wlock=wlock) | 189 n = repo.commit(None, c[4], c[1], force=1, wlock=wlock) |
190 if n == None: | 190 if n == None: |
191 raise util.Abort(_("repo commit failed")) | 191 raise util.Abort(_("repo commit failed")) |
297 self.ui.warn(file_str + '\n') | 297 self.ui.warn(file_str + '\n') |
298 printed_file = True | 298 printed_file = True |
299 self.ui.warn(l + '\n') | 299 self.ui.warn(l + '\n') |
300 | 300 |
301 return (not f.close(), files, fuzz) | 301 return (not f.close(), files, fuzz) |
302 | 302 |
303 def apply(self, repo, series, list=False, update_status=True, | 303 def apply(self, repo, series, list=False, update_status=True, |
304 strict=False, patchdir=None, merge=None, wlock=None): | 304 strict=False, patchdir=None, merge=None, wlock=None): |
305 # TODO unify with commands.py | 305 # TODO unify with commands.py |
306 if not patchdir: | 306 if not patchdir: |
307 patchdir = self.path | 307 patchdir = self.path |
524 if update: | 524 if update: |
525 (c, a, r, d, u) = repo.changes(None, None) | 525 (c, a, r, d, u) = repo.changes(None, None) |
526 if c or a or d or r: | 526 if c or a or d or r: |
527 raise util.Abort(_("local changes found")) | 527 raise util.Abort(_("local changes found")) |
528 urev = self.qparents(repo, rev) | 528 urev = self.qparents(repo, rev) |
529 repo.update(urev, allow=False, force=True, wlock=wlock) | 529 hg.update(repo, urev, allow=False, force=True, wlock=wlock) |
530 repo.dirstate.write() | 530 repo.dirstate.write() |
531 | 531 |
532 # save is a list of all the branches we are truncating away | 532 # save is a list of all the branches we are truncating away |
533 # that we actually want to keep. changegroup will be used | 533 # that we actually want to keep. changegroup will be used |
534 # to preserve them and add them back after the truncate | 534 # to preserve them and add them back after the truncate |
1021 print "queue directory updating" | 1021 print "queue directory updating" |
1022 r = self.qrepo() | 1022 r = self.qrepo() |
1023 if not r: | 1023 if not r: |
1024 self.ui.warn("Unable to load queue repository\n") | 1024 self.ui.warn("Unable to load queue repository\n") |
1025 return 1 | 1025 return 1 |
1026 r.update(qpp[0], allow=False, force=True) | 1026 hg.update(r, qpp[0], allow=False, force=True) |
1027 | 1027 |
1028 def save(self, repo, msg=None): | 1028 def save(self, repo, msg=None): |
1029 if len(self.applied) == 0: | 1029 if len(self.applied) == 0: |
1030 self.ui.warn("save: no patches applied, exiting\n") | 1030 self.ui.warn("save: no patches applied, exiting\n") |
1031 return 1 | 1031 return 1 |
1243 ui.note(_('stripping applied patches from destination repo\n')) | 1243 ui.note(_('stripping applied patches from destination repo\n')) |
1244 reposetup(ui, dr) | 1244 reposetup(ui, dr) |
1245 dr.mq.strip(dr, qbase, update=False, backup=None) | 1245 dr.mq.strip(dr, qbase, update=False, backup=None) |
1246 if not opts['noupdate']: | 1246 if not opts['noupdate']: |
1247 ui.note(_('updating destination repo\n')) | 1247 ui.note(_('updating destination repo\n')) |
1248 dr.update(dr.changelog.tip()) | 1248 hg.update(dr, dr.changelog.tip()) |
1249 | 1249 |
1250 def commit(ui, repo, *pats, **opts): | 1250 def commit(ui, repo, *pats, **opts): |
1251 """commit changes in the queue repository""" | 1251 """commit changes in the queue repository""" |
1252 q = repo.mq | 1252 q = repo.mq |
1253 r = q.qrepo() | 1253 r = q.qrepo() |