Mercurial > hg
comparison hgext/mq.py @ 2848:307439d6fede
mq: do not allow to push from repo with patches applied
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Thu, 10 Aug 2006 16:10:59 -0700 |
parents | addd03c7fbfa |
children | 851b07ec450c |
comparison
equal
deleted
inserted
replaced
2847:2ff57e3113a4 | 2848:307439d6fede |
---|---|
1830 finally: | 1830 finally: |
1831 q.save_dirty() | 1831 q.save_dirty() |
1832 | 1832 |
1833 def reposetup(ui, repo): | 1833 def reposetup(ui, repo): |
1834 class mqrepo(repo.__class__): | 1834 class mqrepo(repo.__class__): |
1835 def abort_if_wdir_patched(self, errmsg, force=False): | |
1836 if self.mq.applied and not force: | |
1837 parent = revlog.hex(self.dirstate.parents()[0]) | |
1838 if parent in [s.rev for s in self.mq.applied]: | |
1839 raise util.Abort(errmsg) | |
1840 | |
1835 def commit(self, *args, **opts): | 1841 def commit(self, *args, **opts): |
1836 if len(args) >= 6: | 1842 if len(args) >= 6: |
1837 force = args[5] | 1843 force = args[5] |
1838 else: | 1844 else: |
1839 force = opts.get('force') | 1845 force = opts.get('force') |
1846 self.abort_if_wdir_patched( | |
1847 _('cannot commit over an applied mq patch'), | |
1848 force) | |
1849 | |
1850 return super(mqrepo, self).commit(*args, **opts) | |
1851 | |
1852 def push(self, remote, force=False, revs=None): | |
1840 if self.mq.applied and not force: | 1853 if self.mq.applied and not force: |
1841 parent = revlog.hex(self.dirstate.parents()[0]) | 1854 raise util.Abort(_('source has mq patches applied')) |
1842 if parent in [s.rev for s in self.mq.applied]: | 1855 return super(mqrepo, self).push(remote, force, revs) |
1843 raise util.Abort(_('cannot commit over an applied mq patch')) | 1856 |
1844 | |
1845 return super(mqrepo, self).commit(*args, **opts) | |
1846 | |
1847 def tags(self): | 1857 def tags(self): |
1848 if self.tagscache: | 1858 if self.tagscache: |
1849 return self.tagscache | 1859 return self.tagscache |
1850 | 1860 |
1851 tagscache = super(mqrepo, self).tags() | 1861 tagscache = super(mqrepo, self).tags() |