hgext/largefiles/overrides.py
changeset 21545 43eecb4e23f8
parent 21524 47b97d9af27e
child 21882 12019e6aa8a2
equal deleted inserted replaced
21541:6062593d8b06 21545:43eecb4e23f8
   408                      acceptremote, followcopies)
   408                      acceptremote, followcopies)
   409 
   409 
   410     if overwrite:
   410     if overwrite:
   411         return actions
   411         return actions
   412 
   412 
   413     removes = set(a[0] for a in actions if a[1] == 'r')
   413     removes = set(a[0] for a in actions['r'])
   414     processed = []
   414 
   415 
   415     newglist = []
   416     for action in actions:
   416     for action in actions['g']:
   417         f, m, args, msg = action
   417         f, args, msg = action
   418 
       
   419         splitstandin = f and lfutil.splitstandin(f)
   418         splitstandin = f and lfutil.splitstandin(f)
   420         if (m == "g" and splitstandin is not None and
   419         if (splitstandin is not None and
   421             splitstandin in p1 and splitstandin not in removes):
   420             splitstandin in p1 and splitstandin not in removes):
   422             # Case 1: normal file in the working copy, largefile in
   421             # Case 1: normal file in the working copy, largefile in
   423             # the second parent
   422             # the second parent
   424             lfile = splitstandin
   423             lfile = splitstandin
   425             standin = f
   424             standin = f
   426             msg = _('remote turned local normal file %s into a largefile\n'
   425             msg = _('remote turned local normal file %s into a largefile\n'
   427                     'use (l)argefile or keep (n)ormal file?'
   426                     'use (l)argefile or keep (n)ormal file?'
   428                     '$$ &Largefile $$ &Normal file') % lfile
   427                     '$$ &Largefile $$ &Normal file') % lfile
   429             if repo.ui.promptchoice(msg, 0) == 0:
   428             if repo.ui.promptchoice(msg, 0) == 0:
   430                 processed.append((lfile, "r", None, msg))
   429                 actions['r'].append((lfile, None, msg))
   431                 processed.append((standin, "g", (p2.flags(standin),), msg))
   430                 newglist.append((standin, (p2.flags(standin),), msg))
   432             else:
   431             else:
   433                 processed.append((standin, "r", None, msg))
   432                 actions['r'].append((standin, None, msg))
   434         elif (m == "g" and
   433         elif lfutil.standin(f) in p1 and lfutil.standin(f) not in removes:
   435             lfutil.standin(f) in p1 and lfutil.standin(f) not in removes):
       
   436             # Case 2: largefile in the working copy, normal file in
   434             # Case 2: largefile in the working copy, normal file in
   437             # the second parent
   435             # the second parent
   438             standin = lfutil.standin(f)
   436             standin = lfutil.standin(f)
   439             lfile = f
   437             lfile = f
   440             msg = _('remote turned local largefile %s into a normal file\n'
   438             msg = _('remote turned local largefile %s into a normal file\n'
   441                     'keep (l)argefile or use (n)ormal file?'
   439                     'keep (l)argefile or use (n)ormal file?'
   442                     '$$ &Largefile $$ &Normal file') % lfile
   440                     '$$ &Largefile $$ &Normal file') % lfile
   443             if repo.ui.promptchoice(msg, 0) == 0:
   441             if repo.ui.promptchoice(msg, 0) == 0:
   444                 processed.append((lfile, "r", None, msg))
   442                 actions['r'].append((lfile, None, msg))
   445             else:
   443             else:
   446                 processed.append((standin, "r", None, msg))
   444                 actions['r'].append((standin, None, msg))
   447                 processed.append((lfile, "g", (p2.flags(lfile),), msg))
   445                 newglist.append((lfile, (p2.flags(lfile),), msg))
   448         else:
   446         else:
   449             processed.append(action)
   447             newglist.append(action)
   450 
   448 
   451     return processed
   449     newglist.sort()
       
   450     actions['g'] = newglist
       
   451 
       
   452     return actions
   452 
   453 
   453 # Override filemerge to prompt the user about how they wish to merge
   454 # Override filemerge to prompt the user about how they wish to merge
   454 # largefiles. This will handle identical edits without prompting the user.
   455 # largefiles. This will handle identical edits without prompting the user.
   455 def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca, labels=None):
   456 def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca, labels=None):
   456     if not lfutil.isstandin(orig):
   457     if not lfutil.isstandin(orig):