##// END OF EJS Templates
localrepo: access status fields by name rather than index
Martin von Zweigbergk -
r22928:5e5d297c default
parent child Browse files
Show More
@@ -1235,9 +1235,9 b' class localrepository(object):'
1235 raise util.Abort(_('cannot partially commit a merge '
1235 raise util.Abort(_('cannot partially commit a merge '
1236 '(do not specify files or patterns)'))
1236 '(do not specify files or patterns)'))
1237
1237
1238 changes = self.status(match=match, clean=force)
1238 status = self.status(match=match, clean=force)
1239 if force:
1239 if force:
1240 changes[0].extend(changes[6]) # mq may commit unchanged files
1240 status.modified.extend(status.clean) # mq may commit clean files
1241
1241
1242 # check subrepos
1242 # check subrepos
1243 subs = []
1243 subs = []
@@ -1246,7 +1246,7 b' class localrepository(object):'
1246 # only manage subrepos and .hgsubstate if .hgsub is present
1246 # only manage subrepos and .hgsubstate if .hgsub is present
1247 if '.hgsub' in wctx:
1247 if '.hgsub' in wctx:
1248 # we'll decide whether to track this ourselves, thanks
1248 # we'll decide whether to track this ourselves, thanks
1249 for c in changes[:3]:
1249 for c in status.modified, status.added, status.removed:
1250 if '.hgsubstate' in c:
1250 if '.hgsubstate' in c:
1251 c.remove('.hgsubstate')
1251 c.remove('.hgsubstate')
1252
1252
@@ -1284,23 +1284,24 b' class localrepository(object):'
1284 '.hgsub' in (wctx.modified() + wctx.added())):
1284 '.hgsub' in (wctx.modified() + wctx.added())):
1285 raise util.Abort(
1285 raise util.Abort(
1286 _("can't commit subrepos without .hgsub"))
1286 _("can't commit subrepos without .hgsub"))
1287 changes[0].insert(0, '.hgsubstate')
1287 status.modified.insert(0, '.hgsubstate')
1288
1288
1289 elif '.hgsub' in changes[2]:
1289 elif '.hgsub' in status.removed:
1290 # clean up .hgsubstate when .hgsub is removed
1290 # clean up .hgsubstate when .hgsub is removed
1291 if ('.hgsubstate' in wctx and
1291 if ('.hgsubstate' in wctx and
1292 '.hgsubstate' not in changes[0] + changes[1] + changes[2]):
1292 '.hgsubstate' not in (status.modified + status.added +
1293 changes[2].insert(0, '.hgsubstate')
1293 status.removed)):
1294 status.removed.insert(0, '.hgsubstate')
1294
1295
1295 # make sure all explicit patterns are matched
1296 # make sure all explicit patterns are matched
1296 if not force and match.files():
1297 if not force and match.files():
1297 matched = set(changes[0] + changes[1] + changes[2])
1298 matched = set(status.modified + status.added + status.removed)
1298
1299
1299 for f in match.files():
1300 for f in match.files():
1300 f = self.dirstate.normalize(f)
1301 f = self.dirstate.normalize(f)
1301 if f == '.' or f in matched or f in wctx.substate:
1302 if f == '.' or f in matched or f in wctx.substate:
1302 continue
1303 continue
1303 if f in changes[3]: # missing
1304 if f in status.deleted:
1304 fail(f, _('file not found!'))
1305 fail(f, _('file not found!'))
1305 if f in vdirs: # visited directory
1306 if f in vdirs: # visited directory
1306 d = f + '/'
1307 d = f + '/'
@@ -1312,7 +1313,7 b' class localrepository(object):'
1312 elif f not in self.dirstate:
1313 elif f not in self.dirstate:
1313 fail(f, _("file not tracked!"))
1314 fail(f, _("file not tracked!"))
1314
1315
1315 cctx = context.workingctx(self, text, user, date, extra, changes)
1316 cctx = context.workingctx(self, text, user, date, extra, status)
1316
1317
1317 if (not force and not extra.get("close") and not merge
1318 if (not force and not extra.get("close") and not merge
1318 and not cctx.files()
1319 and not cctx.files()
@@ -1323,7 +1324,7 b' class localrepository(object):'
1323 raise util.Abort(_("cannot commit merge with missing files"))
1324 raise util.Abort(_("cannot commit merge with missing files"))
1324
1325
1325 ms = mergemod.mergestate(self)
1326 ms = mergemod.mergestate(self)
1326 for f in changes[0]:
1327 for f in status.modified:
1327 if f in ms and ms[f] == 'u':
1328 if f in ms and ms[f] == 'u':
1328 raise util.Abort(_("unresolved merge conflicts "
1329 raise util.Abort(_("unresolved merge conflicts "
1329 "(see hg help resolve)"))
1330 "(see hg help resolve)"))
General Comments 0
You need to be logged in to leave comments. Login now