mercurial/subrepo.py
changeset 19226 c58b6ab4c26f
parent 19156 ed1a212193dc
child 19637 cc338115d3b2
equal deleted inserted replaced
19225:6cf8e3b4e074 19226:c58b6ab4c26f
   189                 wctx.sub(s).get(r, overwrite)
   189                 wctx.sub(s).get(r, overwrite)
   190                 sm[s] = r
   190                 sm[s] = r
   191             elif ld[0] != r[0]: # sources differ
   191             elif ld[0] != r[0]: # sources differ
   192                 if repo.ui.promptchoice(
   192                 if repo.ui.promptchoice(
   193                     _(' subrepository sources for %s differ\n'
   193                     _(' subrepository sources for %s differ\n'
   194                       'use (l)ocal source (%s) or (r)emote source (%s)?')
   194                       'use (l)ocal source (%s) or (r)emote source (%s)?'
   195                       % (s, l[0], r[0]),
   195                       '$$ &Local $$ &Remote') % (s, l[0], r[0]), 0):
   196                       (_('&Local'), _('&Remote')), 0):
       
   197                     debug(s, "prompt changed, get", r)
   196                     debug(s, "prompt changed, get", r)
   198                     wctx.sub(s).get(r, overwrite)
   197                     wctx.sub(s).get(r, overwrite)
   199                     sm[s] = r
   198                     sm[s] = r
   200             elif ld[1] == a[1]: # local side is unchanged
   199             elif ld[1] == a[1]: # local side is unchanged
   201                 debug(s, "other side changed, get", r)
   200                 debug(s, "other side changed, get", r)
   213             sm[s] = l
   212             sm[s] = l
   214             continue
   213             continue
   215         else:
   214         else:
   216             if repo.ui.promptchoice(
   215             if repo.ui.promptchoice(
   217                 _(' local changed subrepository %s which remote removed\n'
   216                 _(' local changed subrepository %s which remote removed\n'
   218                   'use (c)hanged version or (d)elete?') % s,
   217                   'use (c)hanged version or (d)elete?'
   219                 (_('&Changed'), _('&Delete')), 0):
   218                   '$$ &Changed $$ &Delete') % s, 0):
   220                 debug(s, "prompt remove")
   219                 debug(s, "prompt remove")
   221                 wctx.sub(s).remove()
   220                 wctx.sub(s).remove()
   222 
   221 
   223     for s, r in sorted(s2.items()):
   222     for s, r in sorted(s2.items()):
   224         if s in s1:
   223         if s in s1:
   228             mctx.sub(s).get(r)
   227             mctx.sub(s).get(r)
   229             sm[s] = r
   228             sm[s] = r
   230         elif r != sa[s]:
   229         elif r != sa[s]:
   231             if repo.ui.promptchoice(
   230             if repo.ui.promptchoice(
   232                 _(' remote changed subrepository %s which local removed\n'
   231                 _(' remote changed subrepository %s which local removed\n'
   233                   'use (c)hanged version or (d)elete?') % s,
   232                   'use (c)hanged version or (d)elete?'
   234                 (_('&Changed'), _('&Delete')), 0) == 0:
   233                   '$$ &Changed $$ &Delete') % s, 0) == 0:
   235                 debug(s, "prompt recreate", r)
   234                 debug(s, "prompt recreate", r)
   236                 wctx.sub(s).get(r)
   235                 wctx.sub(s).get(r)
   237                 sm[s] = r
   236                 sm[s] = r
   238 
   237 
   239     # record merged .hgsubstate
   238     # record merged .hgsubstate
   240     writestate(repo, sm)
   239     writestate(repo, sm)
   241 
   240 
   242 def _updateprompt(ui, sub, dirty, local, remote):
   241 def _updateprompt(ui, sub, dirty, local, remote):
   243     if dirty:
   242     if dirty:
   244         msg = (_(' subrepository sources for %s differ\n'
   243         msg = (_(' subrepository sources for %s differ\n'
   245                  'use (l)ocal source (%s) or (r)emote source (%s)?\n')
   244                  'use (l)ocal source (%s) or (r)emote source (%s)?\n'
       
   245                  '$$ &Local $$ &Remote')
   246                % (subrelpath(sub), local, remote))
   246                % (subrelpath(sub), local, remote))
   247     else:
   247     else:
   248         msg = (_(' subrepository sources for %s differ (in checked out '
   248         msg = (_(' subrepository sources for %s differ (in checked out '
   249                  'version)\n'
   249                  'version)\n'
   250                  'use (l)ocal source (%s) or (r)emote source (%s)?\n')
   250                  'use (l)ocal source (%s) or (r)emote source (%s)?\n'
       
   251                  '$$ &Local $$ &Remote')
   251                % (subrelpath(sub), local, remote))
   252                % (subrelpath(sub), local, remote))
   252     return ui.promptchoice(msg, (_('&Local'), _('&Remote')), 0)
   253     return ui.promptchoice(msg, 0)
   253 
   254 
   254 def reporelpath(repo):
   255 def reporelpath(repo):
   255     """return path to this (sub)repo as seen from outermost repo"""
   256     """return path to this (sub)repo as seen from outermost repo"""
   256     parent = repo
   257     parent = repo
   257     while util.safehasattr(parent, '_subparent'):
   258     while util.safehasattr(parent, '_subparent'):