hgext/largefiles/overrides.py
changeset 23426 19ebd2f88fc7
parent 23319 3177d710630d
parent 23419 a34a99181f36
child 23428 b5e3f3d25395
equal deleted inserted replaced
23411:2d86f4e38c08 23426:19ebd2f88fc7
   435             lfile = splitstandin
   435             lfile = splitstandin
   436             standin = f
   436             standin = f
   437             msg = _('remote turned local normal file %s into a largefile\n'
   437             msg = _('remote turned local normal file %s into a largefile\n'
   438                     'use (l)argefile or keep (n)ormal file?'
   438                     'use (l)argefile or keep (n)ormal file?'
   439                     '$$ &Largefile $$ &Normal file') % lfile
   439                     '$$ &Largefile $$ &Normal file') % lfile
   440             if repo.ui.promptchoice(msg, 0) == 0:
   440             if (# local has unchanged normal file, pick remote largefile
       
   441                 pas and lfile in pas[0] and
       
   442                 not pas[0][lfile].cmp(p1[lfile]) or
       
   443                 # if remote has unchanged largefile, pick local normal file
       
   444                 not (pas and standin in pas[0] and
       
   445                      not pas[0][standin].cmp(p2[standin])) and
       
   446                 # else, prompt
       
   447                 repo.ui.promptchoice(msg, 0) == 0
       
   448                 ): # pick remote largefile
   441                 actions['r'].append((lfile, None, msg))
   449                 actions['r'].append((lfile, None, msg))
   442                 newglist.append((standin, (p2.flags(standin),), msg))
   450                 newglist.append((standin, (p2.flags(standin),), msg))
   443             else:
   451             else: # keep local normal file
   444                 actions['r'].append((standin, None, msg))
   452                 actions['r'].append((standin, None, msg))
   445         elif lfutil.standin(f) in p1 and lfutil.standin(f) not in removes:
   453         elif lfutil.standin(f) in p1 and lfutil.standin(f) not in removes:
   446             # Case 2: largefile in the working copy, normal file in
   454             # Case 2: largefile in the working copy, normal file in
   447             # the second parent
   455             # the second parent
   448             standin = lfutil.standin(f)
   456             standin = lfutil.standin(f)
   449             lfile = f
   457             lfile = f
   450             msg = _('remote turned local largefile %s into a normal file\n'
   458             msg = _('remote turned local largefile %s into a normal file\n'
   451                     'keep (l)argefile or use (n)ormal file?'
   459                     'keep (l)argefile or use (n)ormal file?'
   452                     '$$ &Largefile $$ &Normal file') % lfile
   460                     '$$ &Largefile $$ &Normal file') % lfile
   453             if repo.ui.promptchoice(msg, 0) == 0:
   461             if (# if remote has unchanged normal file, pick local largefile
       
   462                 pas and f in pas[0] and
       
   463                 not pas[0][f].cmp(p2[f]) or
       
   464                 # if local has unchanged largefile, pick remote normal file
       
   465                 not (pas and standin in pas[0] and
       
   466                      not pas[0][standin].cmp(p1[standin])) and
       
   467                 # else, prompt
       
   468                 repo.ui.promptchoice(msg, 0) == 0
       
   469                 ): # keep local largefile
   454                 if branchmerge:
   470                 if branchmerge:
   455                     # largefile can be restored from standin safely
   471                     # largefile can be restored from standin safely
   456                     actions['r'].append((lfile, None, msg))
   472                     actions['r'].append((lfile, None, msg))
   457                 else:
   473                 else:
   458                     # "lfile" should be marked as "removed" without
   474                     # "lfile" should be marked as "removed" without
   459                     # removal of itself
   475                     # removal of itself
   460                     lfmr.append((lfile, None, msg))
   476                     lfmr.append((lfile, None, msg))
   461 
   477 
   462                     # linear-merge should treat this largefile as 're-added'
   478                     # linear-merge should treat this largefile as 're-added'
   463                     actions['a'].append((standin, None, msg))
   479                     actions['a'].append((standin, None, msg))
   464             else:
   480             else: # pick remote normal file
   465                 actions['r'].append((standin, None, msg))
   481                 actions['r'].append((standin, None, msg))
   466                 newglist.append((lfile, (p2.flags(lfile),), msg))
   482                 newglist.append((lfile, (p2.flags(lfile),), msg))
   467         else:
   483         else:
   468             newglist.append(action)
   484             newglist.append(action)
   469 
   485