Mercurial > hg
changeset 19484:a987972de0e6 stable
merge with i18n
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 25 Jul 2013 00:44:00 -0500 |
parents | 499fc471296b (diff) 1c2c08642681 (current diff) |
children | 02c71f96eb6c |
files | |
diffstat | 19 files changed, 142 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/histedit.py Wed Jul 24 09:43:32 2013 -0300 +++ b/hgext/histedit.py Thu Jul 25 00:44:00 2013 -0500 @@ -512,6 +512,7 @@ os.unlink(os.path.join(repo.path, 'histedit-state')) return else: + cmdutil.checkunfinished(repo) cmdutil.bailifchanged(repo) topmost, empty = repo.dirstate.parents() @@ -679,6 +680,8 @@ if (not obsolete._enabled and repo.revs('(%ld::) - (%ld)', ctxs, ctxs)): raise util.Abort(_('cannot edit history that would orphan nodes')) + if repo.revs('(%ld) and merge()', ctxs): + raise util.Abort(_('cannot edit history that contains merges')) root = ctxs[0] # list is already sorted by repo.set if not root.phase(): raise util.Abort(_('cannot edit immutable changeset: %s') % root) @@ -870,3 +873,6 @@ def extsetup(ui): cmdutil.summaryhooks.add('histedit', summaryhook) + cmdutil.unfinishedstates.append( + ['histedit-state', False, _('histedit in progress'), + _("use 'hg histedit --continue' or 'hg histedit --abort'")])
--- a/hgext/largefiles/overrides.py Wed Jul 24 09:43:32 2013 -0300 +++ b/hgext/largefiles/overrides.py Thu Jul 25 00:44:00 2013 -0500 @@ -250,8 +250,10 @@ """ match = oldmatch(ctx, pats, opts, globbed, default) m = copy.copy(match) - standins = [lfutil.standin(f) for f in m._files] - m._files.extend(standins) + for i in range(0, len(m._files)): + standin = lfutil.standin(m._files[i]) + if standin in repo[ctx.node()]: + m._files[i] = standin m._fmap = set(m._files) m._always = False origmatchfn = m.matchfn
--- a/hgext/mq.py Wed Jul 24 09:43:32 2013 -0300 +++ b/hgext/mq.py Thu Jul 25 00:44:00 2013 -0500 @@ -976,6 +976,7 @@ raise util.Abort(_("local changes found")) def checklocalchanges(self, repo, force=False, refresh=True): + cmdutil.checkunfinished(repo) m, a, r, d = repo.status()[:4] if (m or a or r or d) and not force: self.localchangesfound(refresh)
--- a/hgext/rebase.py Wed Jul 24 09:43:32 2013 -0300 +++ b/hgext/rebase.py Thu Jul 25 00:44:00 2013 -0500 @@ -174,6 +174,7 @@ raise util.Abort(_('cannot specify both a ' 'revision and a source')) + cmdutil.checkunfinished(repo) cmdutil.bailifchanged(repo) if not destf: @@ -258,10 +259,10 @@ if state[rev] == -1: ui.progress(_("rebasing"), pos, ("%d:%s" % (rev, repo[rev])), _('changesets'), total) + p1, p2 = defineparents(repo, rev, target, state, + targetancestors) storestatus(repo, originalwd, target, state, collapsef, keepf, keepbranchesf, external, activebookmark) - p1, p2 = defineparents(repo, rev, target, state, - targetancestors) if len(repo.parents()) == 2: repo.ui.debug('resuming interrupted rebase\n') else: @@ -798,3 +799,6 @@ entry[1].append(('t', 'tool', '', _("specify merge tool for rebase"))) cmdutil.summaryhooks.add('rebase', summaryhook) + cmdutil.unfinishedstates.append( + ['rebasestate', False, _('rebase in progress'), + _("use 'hg rebase --continue' or 'hg rebase --abort'")])
--- a/hgext/transplant.py Wed Jul 24 09:43:32 2013 -0300 +++ b/hgext/transplant.py Thu Jul 25 00:44:00 2013 -0500 @@ -605,6 +605,7 @@ if opts.get('edit'): tp.editor = cmdutil.commitforceeditor + cmdutil.checkunfinished(repo) p1, p2 = repo.dirstate.parents() if len(repo) > 0 and p1 == revlog.nullid: raise util.Abort(_('no revision checked out')) @@ -683,6 +684,9 @@ def extsetup(ui): revset.symbols['transplanted'] = revsettransplanted templatekw.keywords['transplanted'] = kwtransplanted + cmdutil.unfinishedstates.append( + ['series', True, _('transplant in progress'), + _("use 'hg transplant --continue' or 'hg update' to abort")]) # tell hggettext to extract docstrings from these functions: i18nfunctions = [revsettransplanted, kwtransplanted]
--- a/mercurial/cmdutil.py Wed Jul 24 09:43:32 2013 -0300 +++ b/mercurial/cmdutil.py Thu Jul 25 00:44:00 2013 -0500 @@ -2103,3 +2103,34 @@ # a list of (ui, repo) functions called by commands.summary summaryhooks = util.hooks() + +# A list of state files kept by multistep operations like graft. +# Since graft cannot be aborted, it is considered 'clearable' by update. +# note: bisect is intentionally excluded +# (state file, clearable, error, hint) +unfinishedstates = [ + ('graftstate', True, _('graft in progress'), + _("use 'hg graft --continue' or 'hg update' to abort")), + ('updatestate', True, _('last update was interrupted'), + _("use 'hg update' to get a consistent checkout")) + ] + +def checkunfinished(repo): + '''Look for an unfinished multistep operation, like graft, and abort + if found. It's probably good to check this right before + bailifchanged(). + ''' + for f, clearable, msg, hint in unfinishedstates: + if repo.vfs.exists(f): + raise util.Abort(msg, hint=hint) + +def clearunfinished(repo): + '''Check for unfinished operations (as above), and clear the ones + that are clearable. + ''' + for f, clearable, msg, hint in unfinishedstates: + if not clearable and repo.vfs.exists(f): + raise util.Abort(msg, hint=hint) + for f, clearable, msg, hint in unfinishedstates: + if clearable and repo.vfs.exists(f): + util.unlink(repo.join(f))
--- a/mercurial/commands.py Wed Jul 24 09:43:32 2013 -0300 +++ b/mercurial/commands.py Thu Jul 25 00:44:00 2013 -0500 @@ -428,6 +428,7 @@ if date: opts['date'] = util.parsedate(date) + cmdutil.checkunfinished(repo) cmdutil.bailifchanged(repo) node = scmutil.revsingle(repo, rev).node() @@ -651,6 +652,8 @@ elif extra or good + bad + skip + reset + extend + bool(command) > 1: raise util.Abort(_('incompatible arguments')) + cmdutil.checkunfinished(repo) + if reset: p = repo.join("bisect.state") if os.path.exists(p): @@ -1333,9 +1336,7 @@ # Save this for restoring it later oldcommitphase = ui.config('phases', 'new-commit') - if repo.vfs.exists('graftstate'): - raise util.Abort(_('cannot commit an interrupted graft operation'), - hint=_('use "hg graft -c" to continue graft')) + cmdutil.checkunfinished(repo) branch = repo[None].branch() bheads = repo.branchheads(branch) @@ -2977,6 +2978,7 @@ raise raise util.Abort(_("no graft state found, can't continue")) else: + cmdutil.checkunfinished(repo) cmdutil.bailifchanged(repo) if not revs: raise util.Abort(_('no revisions specified')) @@ -3656,6 +3658,8 @@ if sim and not update: raise util.Abort(_('cannot use --similarity with --bypass')) + if update: + cmdutil.checkunfinished(repo) if (opts.get('exact') or not opts.get('force')) and update: cmdutil.bailifchanged(repo) @@ -5478,7 +5482,9 @@ t = ', '.join(t) cleanworkdir = False - if len(parents) > 1: + if repo.vfs.exists('updatestate'): + t += _(' (interrupted update)') + elif len(parents) > 1: t += _(' (merge)') elif branch != parents[0].branch(): t += _(' (new branch)') @@ -5820,6 +5826,8 @@ if rev is None or rev == '': rev = node + cmdutil.clearunfinished(repo) + # with no argument, we also move the current bookmark, if any movemarkfrom = None if rev is None:
--- a/mercurial/fileset.py Wed Jul 24 09:43:32 2013 -0300 +++ b/mercurial/fileset.py Thu Jul 25 00:44:00 2013 -0500 @@ -27,7 +27,7 @@ keywords = set(['and', 'or', 'not']) -globchars = ".*{}[]?/\\" +globchars = ".*{}[]?/\\_" def tokenize(program): pos, l = 0, len(program)
--- a/mercurial/merge.py Wed Jul 24 09:43:32 2013 -0300 +++ b/mercurial/merge.py Thu Jul 25 00:44:00 2013 -0500 @@ -747,12 +747,17 @@ fp1, fp2, xp1, xp2 = fp2, nullid, xp2, '' if not partial: repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) + # note that we're in the middle of an update + repo.vfs.write('updatestate', p2.hex()) stats = applyupdates(repo, actions, wc, p2, pa, overwrite) if not partial: repo.setparents(fp1, fp2) recordupdates(repo, actions, branchmerge) + # update completed, clear state + util.unlink(repo.join('updatestate')) + if not branchmerge: repo.dirstate.setbranch(p2.branch()) finally:
--- a/mercurial/revlog.py Wed Jul 24 09:43:32 2013 -0300 +++ b/mercurial/revlog.py Thu Jul 25 00:44:00 2013 -0500 @@ -751,10 +751,14 @@ def _partialmatch(self, id): try: - return self.index.partialmatch(id) + n = self.index.partialmatch(id) + if n and self.hasnode(n): + return n + return None except RevlogError: # parsers.c radix tree lookup gave multiple matches - raise LookupError(id, self.indexfile, _("ambiguous identifier")) + # fall through to slow path that filters hidden revisions + pass except (AttributeError, ValueError): # we are pure python, or key was too short to search radix tree pass @@ -768,7 +772,8 @@ l = len(id) // 2 # grab an even number of digits prefix = bin(id[:l * 2]) nl = [e[7] for e in self.index if e[7].startswith(prefix)] - nl = [n for n in nl if hex(n).startswith(id)] + nl = [n for n in nl if hex(n).startswith(id) and + self.hasnode(n)] if len(nl) > 0: if len(nl) == 1: self._pcache[id] = nl[0]
--- a/tests/test-fileset.t Wed Jul 24 09:43:32 2013 -0300 +++ b/tests/test-fileset.t Thu Jul 25 00:44:00 2013 -0500 @@ -42,6 +42,7 @@ b2 $ fileset 'a* - a1' a2 + $ fileset 'a_b' Test files status
--- a/tests/test-graft.t Wed Jul 24 09:43:32 2013 -0300 +++ b/tests/test-graft.t Thu Jul 25 00:44:00 2013 -0500 @@ -177,8 +177,8 @@ Commit while interrupted should fail: $ hg ci -m 'commit interrupted graft' - abort: cannot commit an interrupted graft operation - (use "hg graft -c" to continue graft) + abort: graft in progress + (use 'hg graft --continue' or 'hg update' to abort) [255] Abort the graft and try committing:
--- a/tests/test-histedit-edit.t Wed Jul 24 09:43:32 2013 -0300 +++ b/tests/test-histedit-edit.t Thu Jul 25 00:44:00 2013 -0500 @@ -69,16 +69,12 @@ $ hg id -n 3+ $ hg up 0 - 0 files updated, 0 files merged, 3 files removed, 0 files unresolved - $ HGEDITOR='echo foobaz > ' hg histedit --continue - abort: 055a42cdd887 is not an ancestor of working directory - (update to 055a42cdd887 or descendant and run "hg histedit --continue" again) + abort: histedit in progress + (use 'hg histedit --continue' or 'hg histedit --abort') [255] - $ hg up 3 - 3 files updated, 0 files merged, 0 files removed, 0 files unresolved -commit, then edit the revision - $ hg ci -m 'wat' +commit, then edit the revision (temporarily disable histedit to allow commit) + $ hg ci -m 'wat' --config 'extensions.histedit=!' created new head $ echo a > e $ HGEDITOR='echo foobaz > ' hg histedit --continue 2>&1 | fixbundle
--- a/tests/test-histedit-fold.t Wed Jul 24 09:43:32 2013 -0300 +++ b/tests/test-histedit-fold.t Thu Jul 25 00:44:00 2013 -0500 @@ -214,7 +214,7 @@ > 5 > EOF $ hg resolve --mark file - $ hg commit -m '+5.2' + $ hg commit -m '+5.2' --config 'extensions.histedit=!' created new head $ echo 6 >> file $ HGEDITOR=cat hg histedit --continue
--- a/tests/test-histedit-obsolete.t Wed Jul 24 09:43:32 2013 -0300 +++ b/tests/test-histedit-obsolete.t Thu Jul 25 00:44:00 2013 -0500 @@ -441,4 +441,19 @@ | o 0:cb9a9f314b8b (public) a + $ hg co 18 + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ echo wat >> wat + $ hg add wat + $ hg ci -m 'add wat' + created new head + $ hg merge 19 + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + $ hg ci -m 'merge' + $ echo not wat > wat + $ hg ci -m 'modify wat' + $ hg histedit 17 + abort: cannot edit history that contains merges + [255] $ cd ..
--- a/tests/test-largefiles.t Wed Jul 24 09:43:32 2013 -0300 +++ b/tests/test-largefiles.t Thu Jul 25 00:44:00 2013 -0500 @@ -738,6 +738,8 @@ large6 $ cat sub2/large7 large7 + $ hg log -qf sub2/large7 + 7:daea875e9014 $ cd .. $ hg clone a -r 3 c adding changesets
--- a/tests/test-log.t Wed Jul 24 09:43:32 2013 -0300 +++ b/tests/test-log.t Thu Jul 25 00:44:00 2013 -0500 @@ -1223,6 +1223,9 @@ $ hg log --template='{rev}:{node}\n' --hidden 1:a765632148dc55d38c35c4f247c618701886cb2f 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 + $ hg log -r a + abort: unknown revision 'a'! + [255] test that parent prevent a changeset to be hidden
--- a/tests/test-merge1.t Wed Jul 24 09:43:32 2013 -0300 +++ b/tests/test-merge1.t Thu Jul 25 00:44:00 2013 -0500 @@ -23,6 +23,37 @@ $ hg update 0 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + +Test interrupted updates by exploiting our non-handling of directory collisions + + $ mkdir b + $ hg up + abort: Is a directory: '$TESTTMP/t/b' + [255] + $ hg ci + abort: last update was interrupted + (use 'hg update' to get a consistent checkout) + [255] + $ hg sum + parent: 0:538afb845929 + commit #0 + branch: default + commit: (interrupted update) + update: 1 new changesets (update) + $ rmdir b + $ hg up + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg sum + parent: 1:b8bb4a988f25 tip + commit #1 + branch: default + commit: (clean) + update: (current) + +Prepare a basic merge + + $ hg up 0 + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo This is file c1 > c $ hg add c $ hg commit -m "commit #2"
--- a/tests/test-rebase-interruptions.t Wed Jul 24 09:43:32 2013 -0300 +++ b/tests/test-rebase-interruptions.t Thu Jul 25 00:44:00 2013 -0500 @@ -66,11 +66,11 @@ Force a commit on C during the interruption: - $ hg up -q -C 2 + $ hg up -q -C 2 --config 'extensions.rebase=!' $ echo 'Extra' > Extra $ hg add Extra - $ hg ci -m 'Extra' + $ hg ci -m 'Extra' --config 'extensions.rebase=!' Force this commit onto secret phase @@ -156,11 +156,11 @@ Force a commit on B' during the interruption: - $ hg up -q -C 5 + $ hg up -q -C 5 --config 'extensions.rebase=!' $ echo 'Extra' > Extra $ hg add Extra - $ hg ci -m 'Extra' + $ hg ci -m 'Extra' --config 'extensions.rebase=!' $ hg tglog @ 6: 'Extra' @@ -227,7 +227,7 @@ Change phase on B and B' - $ hg up -q -C 5 + $ hg up -q -C 5 --config 'extensions.rebase=!' $ hg phase --public 1 $ hg phase --public 5 $ hg phase --secret -f 2