hgext/largefiles/overrides.py
changeset 19226 c58b6ab4c26f
parent 19161 24877c50aada
child 19472 32e502b26983
equal deleted inserted replaced
19225:6cf8e3b4e074 19226:c58b6ab4c26f
   374         if overwrite:
   374         if overwrite:
   375             processed.append(action)
   375             processed.append(action)
   376             continue
   376             continue
   377         f, m, args, msg = action
   377         f, m, args, msg = action
   378 
   378 
   379         choices = (_('&Largefile'), _('&Normal file'))
       
   380 
       
   381         splitstandin = lfutil.splitstandin(f)
   379         splitstandin = lfutil.splitstandin(f)
   382         if (m == "g" and splitstandin is not None and
   380         if (m == "g" and splitstandin is not None and
   383             splitstandin in p1 and f in p2):
   381             splitstandin in p1 and f in p2):
   384             # Case 1: normal file in the working copy, largefile in
   382             # Case 1: normal file in the working copy, largefile in
   385             # the second parent
   383             # the second parent
   386             lfile = splitstandin
   384             lfile = splitstandin
   387             standin = f
   385             standin = f
   388             msg = _('%s has been turned into a largefile\n'
   386             msg = _('%s has been turned into a largefile\n'
   389                     'use (l)argefile or keep as (n)ormal file?') % lfile
   387                     'use (l)argefile or keep as (n)ormal file?'
   390             if repo.ui.promptchoice(msg, choices, 0) == 0:
   388                     '$$ &Largefile $$ &Normal file') % lfile
       
   389             if repo.ui.promptchoice(msg, 0) == 0:
   391                 processed.append((lfile, "r", None, msg))
   390                 processed.append((lfile, "r", None, msg))
   392                 processed.append((standin, "g", (p2.flags(standin),), msg))
   391                 processed.append((standin, "g", (p2.flags(standin),), msg))
   393             else:
   392             else:
   394                 processed.append((standin, "r", None, msg))
   393                 processed.append((standin, "r", None, msg))
   395         elif m == "g" and lfutil.standin(f) in p1 and f in p2:
   394         elif m == "g" and lfutil.standin(f) in p1 and f in p2:
   396             # Case 2: largefile in the working copy, normal file in
   395             # Case 2: largefile in the working copy, normal file in
   397             # the second parent
   396             # the second parent
   398             standin = lfutil.standin(f)
   397             standin = lfutil.standin(f)
   399             lfile = f
   398             lfile = f
   400             msg = _('%s has been turned into a normal file\n'
   399             msg = _('%s has been turned into a normal file\n'
   401                     'keep as (l)argefile or use (n)ormal file?') % lfile
   400                     'keep as (l)argefile or use (n)ormal file?'
   402             if repo.ui.promptchoice(msg, choices, 0) == 0:
   401                     '$$ &Largefile $$ &Normal file') % lfile
       
   402             if repo.ui.promptchoice(msg, 0) == 0:
   403                 processed.append((lfile, "r", None, msg))
   403                 processed.append((lfile, "r", None, msg))
   404             else:
   404             else:
   405                 processed.append((standin, "r", None, msg))
   405                 processed.append((standin, "r", None, msg))
   406                 processed.append((lfile, "g", (p2.flags(lfile),), msg))
   406                 processed.append((lfile, "g", (p2.flags(lfile),), msg))
   407         else:
   407         else:
   442                 fcancestor.data():
   442                 fcancestor.data():
   443             repo.wwrite(fcdest.path(), fcother.data(), fcother.flags())
   443             repo.wwrite(fcdest.path(), fcother.data(), fcother.flags())
   444             return 0
   444             return 0
   445 
   445 
   446         if repo.ui.promptchoice(_('largefile %s has a merge conflict\n'
   446         if repo.ui.promptchoice(_('largefile %s has a merge conflict\n'
   447                              'keep (l)ocal or take (o)ther?') %
   447                                   'keep (l)ocal or take (o)ther?'
   448                              lfutil.splitstandin(orig),
   448                                   '$$ &Local $$ &Other') %
   449                              (_('&Local'), _('&Other')), 0) == 0:
   449                                 lfutil.splitstandin(orig), 0) == 0:
   450             return 0
   450             return 0
   451         else:
   451         else:
   452             repo.wwrite(fcdest.path(), fcother.data(), fcother.flags())
   452             repo.wwrite(fcdest.path(), fcother.data(), fcother.flags())
   453             return 0
   453             return 0
   454 
   454