##// END OF EJS Templates
mq: replace module-wide repo hash with a repo attribute
Brendan Cully -
r2724:9c41ae19 default
parent child Browse files
Show More
@@ -36,8 +36,6 b' from mercurial import ui, hg, revlog, co'
36 36
37 37 versionstr = "0.45"
38 38
39 repomap = {}
40
41 39 commands.norepo += " qclone qversion"
42 40
43 41 class queue:
@@ -1141,24 +1139,24 b' class queue:'
1141 1139
1142 1140 def delete(ui, repo, patch, **opts):
1143 1141 """remove a patch from the series file"""
1144 q = repomap[repo]
1142 q = repo.mq
1145 1143 q.delete(repo, patch)
1146 1144 q.save_dirty()
1147 1145 return 0
1148 1146
1149 1147 def applied(ui, repo, patch=None, **opts):
1150 1148 """print the patches already applied"""
1151 repomap[repo].qapplied(repo, patch)
1149 repo.mq.qapplied(repo, patch)
1152 1150 return 0
1153 1151
1154 1152 def unapplied(ui, repo, patch=None, **opts):
1155 1153 """print the patches not yet applied"""
1156 repomap[repo].unapplied(repo, patch)
1154 repo.mq.unapplied(repo, patch)
1157 1155 return 0
1158 1156
1159 1157 def qimport(ui, repo, *filename, **opts):
1160 1158 """import a patch"""
1161 q = repomap[repo]
1159 q = repo.mq
1162 1160 q.qimport(repo, filename, patch=opts['name'],
1163 1161 existing=opts['existing'], force=opts['force'])
1164 1162 q.save_dirty()
@@ -1166,7 +1164,7 b' def qimport(ui, repo, *filename, **opts)'
1166 1164
1167 1165 def init(ui, repo, **opts):
1168 1166 """init a new queue repository"""
1169 q = repomap[repo]
1167 q = repo.mq
1170 1168 r = q.init(repo, create=opts['create_repo'])
1171 1169 q.save_dirty()
1172 1170 if r:
@@ -1226,34 +1224,34 b' def clone(ui, source, dest=None, **opts)'
1226 1224
1227 1225 def commit(ui, repo, *pats, **opts):
1228 1226 """commit changes in the queue repository"""
1229 q = repomap[repo]
1227 q = repo.mq
1230 1228 r = q.qrepo()
1231 1229 if not r: raise util.Abort('no queue repository')
1232 1230 commands.commit(r.ui, r, *pats, **opts)
1233 1231
1234 1232 def series(ui, repo, **opts):
1235 1233 """print the entire series file"""
1236 repomap[repo].qseries(repo, missing=opts['missing'])
1234 repo.mq.qseries(repo, missing=opts['missing'])
1237 1235 return 0
1238 1236
1239 1237 def top(ui, repo, **opts):
1240 1238 """print the name of the current patch"""
1241 repomap[repo].top(repo)
1239 repo.mq.top(repo)
1242 1240 return 0
1243 1241
1244 1242 def next(ui, repo, **opts):
1245 1243 """print the name of the next patch"""
1246 repomap[repo].next(repo)
1244 repo.mq.next(repo)
1247 1245 return 0
1248 1246
1249 1247 def prev(ui, repo, **opts):
1250 1248 """print the name of the previous patch"""
1251 repomap[repo].prev(repo)
1249 repo.mq.prev(repo)
1252 1250 return 0
1253 1251
1254 1252 def new(ui, repo, patch, **opts):
1255 1253 """create a new patch"""
1256 q = repomap[repo]
1254 q = repo.mq
1257 1255 message=commands.logmessage(**opts)
1258 1256 q.new(repo, patch, msg=message, force=opts['force'])
1259 1257 q.save_dirty()
@@ -1261,7 +1259,7 b' def new(ui, repo, patch, **opts):'
1261 1259
1262 1260 def refresh(ui, repo, **opts):
1263 1261 """update the current patch"""
1264 q = repomap[repo]
1262 q = repo.mq
1265 1263 message=commands.logmessage(**opts)
1266 1264 q.refresh(repo, msg=message, short=opts['short'])
1267 1265 q.save_dirty()
@@ -1270,7 +1268,7 b' def refresh(ui, repo, **opts):'
1270 1268 def diff(ui, repo, *files, **opts):
1271 1269 """diff of the current patch"""
1272 1270 # deep in the dirstate code, the walkhelper method wants a list, not a tuple
1273 repomap[repo].diff(repo, list(files))
1271 repo.mq.diff(repo, list(files))
1274 1272 return 0
1275 1273
1276 1274 def lastsavename(path):
@@ -1299,7 +1297,7 b' def savename(path):'
1299 1297
1300 1298 def push(ui, repo, patch=None, **opts):
1301 1299 """push the next patch onto the stack"""
1302 q = repomap[repo]
1300 q = repo.mq
1303 1301 mergeq = None
1304 1302
1305 1303 if opts['all']:
@@ -1327,7 +1325,7 b' def pop(ui, repo, patch=None, **opts):'
1327 1325 ui.warn('using patch queue: %s\n' % q.path)
1328 1326 localupdate = False
1329 1327 else:
1330 q = repomap[repo]
1328 q = repo.mq
1331 1329 q.pop(repo, patch, force=opts['force'], update=localupdate, all=opts['all'])
1332 1330 q.save_dirty()
1333 1331 return 0
@@ -1335,7 +1333,7 b' def pop(ui, repo, patch=None, **opts):'
1335 1333 def restore(ui, repo, rev, **opts):
1336 1334 """restore the queue state saved by a rev"""
1337 1335 rev = repo.lookup(rev)
1338 q = repomap[repo]
1336 q = repo.mq
1339 1337 q.restore(repo, rev, delete=opts['delete'],
1340 1338 qupdate=opts['update'])
1341 1339 q.save_dirty()
@@ -1343,7 +1341,7 b' def restore(ui, repo, rev, **opts):'
1343 1341
1344 1342 def save(ui, repo, **opts):
1345 1343 """save current queue state"""
1346 q = repomap[repo]
1344 q = repo.mq
1347 1345 message=commands.logmessage(**opts)
1348 1346 ret = q.save(repo, msg=message)
1349 1347 if ret:
@@ -1379,7 +1377,7 b' def strip(ui, repo, rev, **opts):'
1379 1377 backup = 'strip'
1380 1378 elif opts['nobackup']:
1381 1379 backup = 'none'
1382 repomap[repo].strip(repo, rev, backup=backup)
1380 repo.mq.strip(repo, rev, backup=backup)
1383 1381 return 0
1384 1382
1385 1383 def version(ui, q=None):
@@ -1395,7 +1393,7 b' def reposetup(ui, repo):'
1395 1393
1396 1394 tagscache = super(self.__class__, self).tags()
1397 1395
1398 q = repomap[repo]
1396 q = self.mq
1399 1397 if not q.applied:
1400 1398 return tagscache
1401 1399
@@ -1411,7 +1409,7 b' def reposetup(ui, repo):'
1411 1409 return tagscache
1412 1410
1413 1411 repo.__class__ = MqRepo
1414 repomap[repo] = queue(ui, repo.join(""))
1412 repo.mq = queue(ui, repo.join(""))
1415 1413
1416 1414 cmdtable = {
1417 1415 "qapplied": (applied, [], 'hg qapplied [PATCH]'),
General Comments 0
You need to be logged in to leave comments. Login now