# HG changeset patch # User Wagner Bruna # Date 1277824722 10800 # Node ID 57afaabc87c5420ee706777a52d69a3a11b74d16 # Parent 6e8cf1024497deb50171a1e92c2df8ab59d7a885# Parent 2b83c26b29f3f99b68fca8575d53a087e0f1e13a merge with stable diff -r 6e8cf1024497 -r 57afaabc87c5 contrib/mercurial.spec --- a/contrib/mercurial.spec Tue Jun 29 09:11:55 2010 +0200 +++ b/contrib/mercurial.spec Tue Jun 29 12:18:42 2010 -0300 @@ -41,7 +41,6 @@ make install DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} MANDIR=%{_mandir} install contrib/hgk $RPM_BUILD_ROOT%{_bindir} -install contrib/convert-repo $RPM_BUILD_ROOT%{_bindir}/mercurial-convert-repo install contrib/hg-ssh $RPM_BUILD_ROOT%{_bindir} bash_completion_dir=$RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d @@ -74,7 +73,6 @@ %{_bindir}/hg %{_bindir}/hgk %{_bindir}/hg-ssh -%{_bindir}/mercurial-convert-repo %dir %{_sysconfdir}/bash_completion.d/ %dir %{_datadir}/zsh/site-functions/ %dir %{_sysconfdir}/mercurial diff -r 6e8cf1024497 -r 57afaabc87c5 contrib/tcsh_completion --- a/contrib/tcsh_completion Tue Jun 29 09:11:55 2010 +0200 +++ b/contrib/tcsh_completion Tue Jun 29 12:18:42 2010 -0300 @@ -2,7 +2,7 @@ # tcsh completion for Mercurial # # This file has been auto-generated by tcsh_completion_build.sh for -# Mercurial Distributed SCM (version 1.3.1+269-5d8125bbbbf4) +# Mercurial Distributed SCM (version 1.5.4+154-8b452fe4bf50) # # Copyright (C) 2005 TK Soh. # @@ -32,18 +32,19 @@ 'p/1/(add addremove annotate blame archive \ backout bisect branch branches bundle \ cat clone commit ci copy \ - cp debugancestor debugcheckstate debugcommands debugcomplete \ - debugdata debugdate debugfsinfo debugindex debugindexdot \ - debuginstall debugrebuildstate debugrename debugsetparents debugstate \ - debugsub debugwalk diff export forget \ - grep heads help identify id \ - import patch incoming in init \ - locate log history manifest merge \ - outgoing out parents paths pull \ - push recover remove rm rename \ - mv resolve revert rollback root \ - serve showconfig debugconfig status st \ - summary sum tag tags tip \ - unbundle update up checkout co \ - verify version)/' + cp debugancestor debugbuilddag debugcheckstate debugcommands \ + debugcomplete debugdag debugdata debugdate debugfsinfo \ + debugindex debugindexdot debuginstall debugpushkey debugrebuildstate \ + debugrename debugrevspec debugsetparents debugstate debugsub \ + debugwalk diff export forget grep \ + heads help identify id import \ + patch incoming in init locate \ + log history manifest merge outgoing \ + out parents paths pull push \ + recover remove rm rename mv \ + resolve revert rollback root serve \ + showconfig debugconfig status st summary \ + sum tag tags tip unbundle \ + update up checkout co verify \ + version)/' diff -r 6e8cf1024497 -r 57afaabc87c5 hgext/graphlog.py --- a/hgext/graphlog.py Tue Jun 29 09:11:55 2010 +0200 +++ b/hgext/graphlog.py Tue Jun 29 12:18:42 2010 -0300 @@ -209,6 +209,8 @@ def get_revs(repo, rev_opt): if rev_opt: revs = revrange(repo, rev_opt) + if len(revs) == 0: + return (nullrev, nullrev) return (max(revs), min(revs)) else: return (len(repo) - 1, 0) diff -r 6e8cf1024497 -r 57afaabc87c5 hgext/progress.py --- a/hgext/progress.py Tue Jun 29 09:11:55 2010 +0200 +++ b/hgext/progress.py Tue Jun 29 12:18:42 2010 -0300 @@ -51,6 +51,9 @@ def spacejoin(*args): return ' '.join(s for s in args if s) +def shouldprint(ui): + return sys.stderr.isatty() or ui.configbool('progress', 'assume-tty') + class progbar(object): def __init__(self, ui): self.ui = ui @@ -69,6 +72,8 @@ default=['topic', 'bar', 'number']) def show(self, topic, pos, item, unit, total): + if not shouldprint(self.ui): + return termwidth = self.width() self.printed = True head = '' @@ -137,9 +142,13 @@ sys.stderr.flush() def clear(self): + if not shouldprint(self.ui): + return sys.stderr.write('\r%s\r' % (' ' * self.width())) def complete(self): + if not shouldprint(self.ui): + return if self.ui.configbool('progress', 'clear-complete', default=True): self.clear() else: @@ -177,8 +186,7 @@ # setconfig('progress', 'disable', 'True') to disable this extension if ui.configbool('progress', 'disable'): return - if ((sys.stderr.isatty() or ui.configbool('progress', 'assume-tty')) - and not ui.debugflag and not ui.quiet): + if shouldprint(ui) and not ui.debugflag and not ui.quiet: # we instantiate one globally shared progress bar to avoid # competing progress bars when multiple UI objects get created global sharedprog diff -r 6e8cf1024497 -r 57afaabc87c5 mercurial/commands.py --- a/mercurial/commands.py Tue Jun 29 09:11:55 2010 +0200 +++ b/mercurial/commands.py Tue Jun 29 12:18:42 2010 -0300 @@ -2570,6 +2570,10 @@ head, the other head is merged with by default. Otherwise, an explicit revision with which to merge with must be provided. + To undo an uncommitted merge, use :hg:`update --clean .` which + will check out a clean copy of the original merge parent, losing + all changes. + Returns 0 on success, 1 if there are unresolved files. """ @@ -3015,8 +3019,11 @@ def revert(ui, repo, *pats, **opts): """restore individual files or directories to an earlier state - (Use update -r to check out earlier revisions, revert does not - change the working directory parents.) + NOTE: This command is most likely not what you are looking for. revert + will partially overwrite content in the working directory without changing + the working directory parents. Use :hg:`update -r rev` to check out earlier + revisions, or :hg:`update --clean .` to undo a merge which has added + another parent. With no revision specified, revert the named files or directories to the contents they had in the parent of the working directory. diff -r 6e8cf1024497 -r 57afaabc87c5 mercurial/context.py --- a/mercurial/context.py Tue Jun 29 09:11:55 2010 +0200 +++ b/mercurial/context.py Tue Jun 29 12:18:42 2010 -0300 @@ -490,12 +490,16 @@ return zip(hist[f][0], hist[f][1].splitlines(True)) - def ancestor(self, fc2): + def ancestor(self, fc2, actx=None): """ find the common ancestor file context, if any, of self, and fc2 + + If actx is given, it must be the changectx of the common ancestor + of self's and fc2's respective changesets. """ - actx = self.changectx().ancestor(fc2.changectx()) + if actx is None: + actx = self.changectx().ancestor(fc2.changectx()) # the trivial case: changesets are unrelated, files must be too if not actx: diff -r 6e8cf1024497 -r 57afaabc87c5 mercurial/help/revsets.txt --- a/mercurial/help/revsets.txt Tue Jun 29 09:11:55 2010 +0200 +++ b/mercurial/help/revsets.txt Tue Jun 29 12:18:42 2010 -0300 @@ -21,7 +21,7 @@ A DAG range, meaning all changesets that are descendants of x and ancestors of y, including x and y themselves. If the first endpoint is left out, this is equivalent to ``ancestors(y)``, if the second - is left out it is equivalent to ``descendents(x)``. + is left out it is equivalent to ``descendants(x)``. An alternative syntax is ``x..y``. diff -r 6e8cf1024497 -r 57afaabc87c5 mercurial/merge.py --- a/mercurial/merge.py Tue Jun 29 09:11:55 2010 +0200 +++ b/mercurial/merge.py Tue Jun 29 12:18:42 2010 -0300 @@ -23,15 +23,13 @@ def _read(self): self._state = {} try: - localnode = None f = self._repo.opener("merge/state") for i, l in enumerate(f): if i == 0: - localnode = l[:-1] + self._local = bin(l[:-1]) else: bits = l[:-1].split("\0") self._state[bits[0]] = bits[1:] - self._local = bin(localnode) except IOError, err: if err.errno != errno.ENOENT: raise @@ -244,8 +242,13 @@ def actionkey(a): return a[1] == 'r' and -1 or 0, a -def applyupdates(repo, action, wctx, mctx): - "apply the merge action list to the working directory" +def applyupdates(repo, action, wctx, mctx, actx): + """apply the merge action list to the working directory + + wctx is the working copy context + mctx is the context to be merged into the working copy + actx is the context of the common ancestor + """ updated, merged, removed, unresolved = 0, 0, 0, 0 ms = mergestate(repo) @@ -265,7 +268,7 @@ repo.ui.debug("preserving %s for resolve of %s\n" % (f, fd)) fcl = wctx[f] fco = mctx[f2] - fca = fcl.ancestor(fco) or repo.filectx(f, fileid=nullrev) + fca = fcl.ancestor(fco, actx) or repo.filectx(f, fileid=nullrev) ms.add(fcl, fco, fca, fd, flags) if f != fd and move: moves.append(f) @@ -507,7 +510,7 @@ if not partial: repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) - stats = applyupdates(repo, action, wc, p2) + stats = applyupdates(repo, action, wc, p2, pa) if not partial: repo.dirstate.setparents(fp1, fp2) diff -r 6e8cf1024497 -r 57afaabc87c5 mercurial/parser.py --- a/mercurial/parser.py Tue Jun 29 09:11:55 2010 +0200 +++ b/mercurial/parser.py Tue Jun 29 12:18:42 2010 -0300 @@ -5,7 +5,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -# see http://effbot.org/zone/simple-top-down-parsing.txt and +# see http://effbot.org/zone/simple-top-down-parsing.htm and # http://eli.thegreenplace.net/2010/01/02/top-down-operator-precedence-parsing/ # for background diff -r 6e8cf1024497 -r 57afaabc87c5 mercurial/revset.py --- a/mercurial/revset.py Tue Jun 29 09:11:55 2010 +0200 +++ b/mercurial/revset.py Tue Jun 29 12:18:42 2010 -0300 @@ -129,11 +129,24 @@ return stringset(repo, subset, x) def rangeset(repo, subset, x, y): - m = getset(repo, subset, x)[0] - n = getset(repo, subset, y)[-1] + m = getset(repo, subset, x) + if not m: + m = getset(repo, range(len(repo)), x) + + n = getset(repo, subset, y) + if not n: + n = getset(repo, range(len(repo)), y) + + if not m or not n: + return [] + m, n = m[0], n[-1] + if m < n: - return range(m, n + 1) - return range(m, n - 1, -1) + r = range(m, n + 1) + else: + r = range(m, n - 1, -1) + s = set(subset) + return [x for x in r if x in s] def andset(repo, subset, x, y): return getset(repo, getset(repo, subset, x), y) @@ -222,11 +235,15 @@ def ancestors(repo, subset, x): args = getset(repo, range(len(repo)), x) + if not args: + return [] s = set(repo.changelog.ancestors(*args)) | set(args) return [r for r in subset if r in s] def descendants(repo, subset, x): args = getset(repo, range(len(repo)), x) + if not args: + return [] s = set(repo.changelog.descendants(*args)) | set(args) return [r for r in subset if r in s] @@ -422,7 +439,6 @@ repo.ui.popbuffer() cl = repo.changelog o = set([cl.rev(r) for r in repo.changelog.nodesbetween(o, None)[0]]) - print 'out', dest, o return [r for r in subset if r in o] def tagged(repo, subset, x): diff -r 6e8cf1024497 -r 57afaabc87c5 mercurial/subrepo.py --- a/mercurial/subrepo.py Tue Jun 29 09:11:55 2010 +0200 +++ b/mercurial/subrepo.py Tue Jun 29 12:18:42 2010 -0300 @@ -379,8 +379,8 @@ self.get(state) def push(self, force): - # nothing for svn - pass + # push is a no-op for SVN + return True types = { 'hg': hgsubrepo, diff -r 6e8cf1024497 -r 57afaabc87c5 mercurial/url.py --- a/mercurial/url.py Tue Jun 29 09:11:55 2010 +0200 +++ b/mercurial/url.py Tue Jun 29 12:18:42 2010 -0300 @@ -542,11 +542,25 @@ conn.ui = self.ui return conn -# In python < 2.5 AbstractDigestAuthHandler raises a ValueError if -# it doesn't know about the auth type requested. This can happen if -# somebody is using BasicAuth and types a bad password. class httpdigestauthhandler(urllib2.HTTPDigestAuthHandler): + def __init__(self, *args, **kwargs): + urllib2.HTTPDigestAuthHandler.__init__(self, *args, **kwargs) + self.retried_req = None + + def reset_retry_count(self): + # Python 2.6.5 will call this on 401 or 407 errors and thus loop + # forever. We disable reset_retry_count completely and reset in + # http_error_auth_reqed instead. + pass + def http_error_auth_reqed(self, auth_header, host, req, headers): + # Reset the retry counter once for each request. + if req is not self.retried_req: + self.retried_req = req + self.retried = 0 + # In python < 2.5 AbstractDigestAuthHandler raises a ValueError if + # it doesn't know about the auth type requested. This can happen if + # somebody is using BasicAuth and types a bad password. try: return urllib2.HTTPDigestAuthHandler.http_error_auth_reqed( self, auth_header, host, req, headers) @@ -556,13 +570,6 @@ return raise - # Python 2.6.5 will keep resetting the retry count on redirects, for - # example when the server returns 401 on failing auth (like google code - # currently does). We stop the endless recursion by not resetting the - # count. - def reset_retry_count(self): - pass - def getauthinfo(path): scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path) if not urlpath: diff -r 6e8cf1024497 -r 57afaabc87c5 tests/test-acl --- a/tests/test-acl Tue Jun 29 09:11:55 2010 +0200 +++ b/tests/test-acl Tue Jun 29 12:18:42 2010 -0300 @@ -44,7 +44,7 @@ [acl] sources = push [extensions] -f=$PWD/fakegroups.py +f=`pwd`/fakegroups.py EOF } diff -r 6e8cf1024497 -r 57afaabc87c5 tests/test-alias --- a/tests/test-alias Tue Jun 29 09:11:55 2010 +0200 +++ b/tests/test-alias Tue Jun 29 12:18:42 2010 -0300 @@ -13,7 +13,7 @@ shortlog = log --template '{rev} {node|short} | {date|isodate}\n' dln = lognull --debug nousage = rollback -put = export -r 0 -o "\$PWD/%R.diff" +put = export -r 0 -o "\$FOO/%R.diff" [defaults] mylog = -q @@ -62,5 +62,5 @@ hg dln echo '% path expanding' -hg put +FOO=`pwd` hg put cat 0.diff diff -r 6e8cf1024497 -r 57afaabc87c5 tests/test-glog --- a/tests/test-glog Tue Jun 29 09:11:55 2010 +0200 +++ b/tests/test-glog Tue Jun 29 12:18:42 2010 -0300 @@ -146,6 +146,9 @@ echo % unused arguments hg glog -q foo bar || echo failed +echo % empty revision range - display nothing +hg glog -r 1..0 + echo % from outer space cd .. hg glog -l1 repo diff -r 6e8cf1024497 -r 57afaabc87c5 tests/test-glog.out --- a/tests/test-glog.out Tue Jun 29 09:11:55 2010 +0200 +++ b/tests/test-glog.out Tue Jun 29 12:18:42 2010 -0300 @@ -548,6 +548,7 @@ show revision history alongside an ASCII revision graph failed +% empty revision range - display nothing % from outer space @ changeset: 34:fea3ac5810e0 | tag: tip diff -r 6e8cf1024497 -r 57afaabc87c5 tests/test-resolve --- a/tests/test-resolve Tue Jun 29 09:11:55 2010 +0200 +++ b/tests/test-resolve Tue Jun 29 12:18:42 2010 -0300 @@ -25,3 +25,9 @@ echo % resolve -l, should be empty hg resolve -l + +# test crashed merge with empty mergestate +mkdir .hg/merge +touch .hg/merge/state +echo % resolve -l, should be empty +hg resolve -l diff -r 6e8cf1024497 -r 57afaabc87c5 tests/test-resolve.out --- a/tests/test-resolve.out Tue Jun 29 09:11:55 2010 +0200 +++ b/tests/test-resolve.out Tue Jun 29 12:18:42 2010 -0300 @@ -6,3 +6,4 @@ 0 files updated, 0 files merged, 0 files removed, 1 files unresolved use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon % resolve -l, should be empty +% resolve -l, should be empty diff -r 6e8cf1024497 -r 57afaabc87c5 tests/test-revset --- a/tests/test-revset Tue Jun 29 09:11:55 2010 +0200 +++ b/tests/test-revset Tue Jun 29 12:18:42 2010 -0300 @@ -126,3 +126,10 @@ log '4:8' log 'sort(!merge() & (modifies(b) | user(bob) | keyword(bug) | keyword(issue) & 1::9), "-date")' + +log 'not 0 and 0:2' +log 'not 1 and 0:2' +log 'not 2 and 0:2' +log '(1 and 2)::' +log '(1 and 2):' +log '(1 and 2):3' diff -r 6e8cf1024497 -r 57afaabc87c5 tests/test-revset.out --- a/tests/test-revset.out Tue Jun 29 09:11:55 2010 +0200 +++ b/tests/test-revset.out Tue Jun 29 12:18:42 2010 -0300 @@ -198,3 +198,15 @@ 4 2 5 +% log 'not 0 and 0:2' +1 +2 +% log 'not 1 and 0:2' +0 +2 +% log 'not 2 and 0:2' +0 +1 +% log '(1 and 2)::' +% log '(1 and 2):' +% log '(1 and 2):3'