comparison hgext/mq.py @ 13035:f08df4d38442 stable

mq: ignore subrepos (issue2499) If MQ allows modifying .hgsub or .hgsubstate in a patch, it can easily lead to an inconsistent subrepo state. This patch prevents qrefresh from adding any modifications to .hgsub or .hgsubstate to a patch. The user is warned that these files are not included in the patch. The tests test both the slightly irrational and the pathological cases.
author Kevin Bullock <kbullock@ringworld.org>
date Tue, 16 Nov 2010 13:06:07 -0600
parents da4a9ed369c8
children 77aa74fe0e0b 0a1eefaf98f2
comparison
equal deleted inserted replaced
13025:99210fb3bc0a 13035:f08df4d38442
1293 # we might end up with files that were added between 1293 # we might end up with files that were added between
1294 # qtip and the dirstate parent, but then changed in the 1294 # qtip and the dirstate parent, but then changed in the
1295 # local dirstate. in this case, we want them to only 1295 # local dirstate. in this case, we want them to only
1296 # show up in the added section 1296 # show up in the added section
1297 for x in m: 1297 for x in m:
1298 if x == '.hgsub' or x == '.hgsubstate':
1299 self.ui.warn(_('warning: not refreshing %s\n') % x)
1300 continue
1298 if x not in aa: 1301 if x not in aa:
1299 mm.append(x) 1302 mm.append(x)
1300 # we might end up with files added by the local dirstate that 1303 # we might end up with files added by the local dirstate that
1301 # were deleted by the patch. In this case, they should only 1304 # were deleted by the patch. In this case, they should only
1302 # show up in the changed section. 1305 # show up in the changed section.
1303 for x in a: 1306 for x in a:
1307 if x == '.hgsub' or x == '.hgsubstate':
1308 self.ui.warn(_('warning: not adding %s\n') % x)
1309 continue
1304 if x in dd: 1310 if x in dd:
1305 del dd[dd.index(x)] 1311 del dd[dd.index(x)]
1306 mm.append(x) 1312 mm.append(x)
1307 else: 1313 else:
1308 aa.append(x) 1314 aa.append(x)
1309 # make sure any files deleted in the local dirstate 1315 # make sure any files deleted in the local dirstate
1310 # are not in the add or change column of the patch 1316 # are not in the add or change column of the patch
1311 forget = [] 1317 forget = []
1312 for x in d + r: 1318 for x in d + r:
1319 if x == '.hgsub' or x == '.hgsubstate':
1320 self.ui.warn(_('warning: not removing %s\n') % x)
1321 continue
1313 if x in aa: 1322 if x in aa:
1314 del aa[aa.index(x)] 1323 del aa[aa.index(x)]
1315 forget.append(x) 1324 forget.append(x)
1316 continue 1325 continue
1317 elif x in mm: 1326 elif x in mm: