comparison hgext/mq.py @ 2511:041d8f0a8437

mq: hg qnew -f should refresh the new patch qnew -f was originally meant to just skip the localchanges check. But, it currently discards the local changes, which is not at all what people expect. This patch changes qnew -f to create the new patch and then run hg qrefresh on it. The local changes will be in the new patch.
author Chris Mason <mason@suse.com>
date Tue, 27 Jun 2006 11:23:06 -0400
parents 2785aeb51be4
children e4deeaac5e74
comparison
equal deleted inserted replaced
2510:cbff06469488 2511:041d8f0a8437
384 (c, a, r, d, u) = repo.changes(None, None) 384 (c, a, r, d, u) = repo.changes(None, None)
385 if c or a or d or r: 385 if c or a or d or r:
386 self.ui.write("Local changes found, refresh first\n") 386 self.ui.write("Local changes found, refresh first\n")
387 sys.exit(1) 387 sys.exit(1)
388 def new(self, repo, patch, msg=None, force=None): 388 def new(self, repo, patch, msg=None, force=None):
389 if not force: 389 commitfiles = []
390 self.check_localchanges(repo) 390 (c, a, r, d, u) = repo.changes(None, None)
391 if c or a or d or r:
392 if not force:
393 raise util.Abort(_("Local changes found, refresh first"))
394 else:
395 commitfiles = c + a + r
391 self.check_toppatch(repo) 396 self.check_toppatch(repo)
392 wlock = repo.wlock() 397 wlock = repo.wlock()
393 insert = self.series_end() 398 insert = self.series_end()
394 if msg: 399 if msg:
395 n = repo.commit([], "[mq]: %s" % msg, force=True, wlock=wlock) 400 n = repo.commit(commitfiles, "[mq]: %s" % msg, force=True,
396 else: 401 wlock=wlock)
397 n = repo.commit([], 402 else:
403 n = repo.commit(commitfiles,
398 "New patch: %s" % patch, force=True, wlock=wlock) 404 "New patch: %s" % patch, force=True, wlock=wlock)
399 if n == None: 405 if n == None:
400 self.ui.warn("repo commit failed\n") 406 self.ui.warn("repo commit failed\n")
401 sys.exit(1) 407 sys.exit(1)
402 self.full_series[insert:insert] = [patch] 408 self.full_series[insert:insert] = [patch]
410 p.write(msg) 416 p.write(msg)
411 p.close() 417 p.close()
412 wlock = None 418 wlock = None
413 r = self.qrepo() 419 r = self.qrepo()
414 if r: r.add([patch]) 420 if r: r.add([patch])
421 if commitfiles:
422 self.refresh(repo, short=True)
415 423
416 def strip(self, repo, rev, update=True, backup="all", wlock=None): 424 def strip(self, repo, rev, update=True, backup="all", wlock=None):
417 def limitheads(chlog, stop): 425 def limitheads(chlog, stop):
418 """return the list of all nodes that have no children""" 426 """return the list of all nodes that have no children"""
419 p = {} 427 p = {}