##// END OF EJS Templates
mq: do not allow to push from repo with patches applied
Vadim Gelfer -
r2848:307439d6 default
parent child Browse files
Show More
@@ -1832,18 +1832,28 b' def select(ui, repo, *args, **opts):'
1832 1832
1833 1833 def reposetup(ui, repo):
1834 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 1841 def commit(self, *args, **opts):
1836 1842 if len(args) >= 6:
1837 1843 force = args[5]
1838 1844 else:
1839 1845 force = opts.get('force')
1840 if self.mq.applied and not force:
1841 parent = revlog.hex(self.dirstate.parents()[0])
1842 if parent in [s.rev for s in self.mq.applied]:
1843 raise util.Abort(_('cannot commit over an applied mq patch'))
1846 self.abort_if_wdir_patched(
1847 _('cannot commit over an applied mq patch'),
1848 force)
1844 1849
1845 1850 return super(mqrepo, self).commit(*args, **opts)
1846 1851
1852 def push(self, remote, force=False, revs=None):
1853 if self.mq.applied and not force:
1854 raise util.Abort(_('source has mq patches applied'))
1855 return super(mqrepo, self).push(remote, force, revs)
1856
1847 1857 def tags(self):
1848 1858 if self.tagscache:
1849 1859 return self.tagscache
@@ -10,6 +10,10 b' hg help mq'
10 10 hg init a
11 11 cd a
12 12 echo a > a
13 hg ci -Ama
14
15 hg clone . ../k
16
13 17 mkdir b
14 18 echo z > b/z
15 19 hg ci -Ama
@@ -106,9 +110,16 b' hg qapplied'
106 110 echo % commit should fail
107 111 hg commit
108 112
113 echo % push should fail
114 hg push ../../k
115
109 116 echo % qunapplied
110 117 hg qunapplied
111 118
119 echo % push should succeed
120 hg qpop -a
121 hg push ../../k
122
112 123 echo % strip
113 124 cd ../../b
114 125 echo x>x
@@ -49,6 +49,7 b' list of commands (use "hg help -v mq" to'
49 49 qunapplied print the patches not yet applied
50 50 strip strip a revision and all later revs on the same branch
51 51 adding a
52 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
52 53 adding b/z
53 54 % qinit
54 55 % -R qinit
@@ -104,6 +105,9 b' Only one patch applied'
104 105 test.patch
105 106 % commit should fail
106 107 abort: cannot commit over an applied mq patch
108 % push should fail
109 pushing to ../../k
110 abort: source has mq patches applied
107 111 % qunapplied
108 112 test2.patch
109 113 % strip
General Comments 0
You need to be logged in to leave comments. Login now