changeset 20169:507919a34c5b

merge with stable
author Matt Mackall <mpm@selenic.com>
date Fri, 13 Dec 2013 17:23:02 -0600
parents 7eda5bb9ec8f (diff) d4be314b2071 (current diff)
children 5ff0fd023850
files mercurial/hgweb/hgweb_mod.py mercurial/parsers.c
diffstat 152 files changed, 1776 insertions(+), 962 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Wed Dec 04 13:42:28 2013 -0600
+++ b/.hgignore	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,7 @@
 syntax: glob
 
 *.elc
+*.tmp
 *.orig
 *.rej
 *~
--- a/Makefile	Wed Dec 04 13:42:28 2013 -0600
+++ b/Makefile	Fri Dec 13 17:23:02 2013 -0600
@@ -53,7 +53,8 @@
 
 clean:
 	-$(PYTHON) setup.py clean --all # ignore errors from this command
-	find . \( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
+	find contrib doc hgext i18n mercurial tests \
+		\( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
 	rm -f $(addprefix mercurial/,$(notdir $(wildcard mercurial/pure/[a-z]*.py)))
 	rm -f MANIFEST MANIFEST.in mercurial/__version__.py tests/*.err
 	rm -rf build mercurial/locale
@@ -107,7 +108,7 @@
 	  mercurial/fileset.py mercurial/revset.py \
 	  mercurial/templatefilters.py mercurial/templatekw.py \
 	  mercurial/filemerge.py \
-	  $(DOCFILES) > i18n/hg.pot
+	  $(DOCFILES) > i18n/hg.pot.tmp
         # All strings marked for translation in Mercurial contain
         # ASCII characters only. But some files contain string
         # literals like this '\037\213'. xgettext thinks it has to
@@ -119,11 +120,17 @@
 	  --msgid-bugs-address "<mercurial-devel@selenic.com>" \
 	  --copyright-holder "Matt Mackall <mpm@selenic.com> and others" \
 	  --from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \
-	  -d hg -p i18n -o hg.pot
-	$(PYTHON) i18n/posplit i18n/hg.pot
+	  -d hg -p i18n -o hg.pot.tmp
+	$(PYTHON) i18n/posplit i18n/hg.pot.tmp
+        # The target file is not created before the last step. So it never is in
+        # an intermediate state.
+	mv -f i18n/hg.pot.tmp i18n/hg.pot
 
 %.po: i18n/hg.pot
-	msgmerge --no-location --update $@ $^
+        # work on a temporary copy for never having a half completed target
+	cp $@ $@.tmp
+	msgmerge --no-location --update $@.tmp $^
+	mv -f $@.tmp $@
 
 .PHONY: help all local build doc clean install install-bin install-doc \
 	install-home install-home-bin install-home-doc dist dist-notests tests \
--- a/contrib/bash_completion	Wed Dec 04 13:42:28 2013 -0600
+++ b/contrib/bash_completion	Fri Dec 13 17:23:02 2013 -0600
@@ -76,7 +76,7 @@
 {
     local i
     for i in $(compgen -d -- "$cur"); do
-	test ! -d "$i"/.hg || COMPREPLY=(${COMPREPLY[@]:-} "$i")
+        test ! -d "$i"/.hg || COMPREPLY=(${COMPREPLY[@]:-} "$i")
     done
 }
 
@@ -84,7 +84,6 @@
 {
     local files="$(_hg_cmd debugpathcomplete $1 "$cur")"
     local IFS=$'\n'
-    compopt -o filenames 2>/dev/null
     COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur"))
 }
 
@@ -92,10 +91,16 @@
 {
     local files="$(_hg_cmd status -n$1 "glob:$cur**")"
     local IFS=$'\n'
-    compopt -o filenames 2>/dev/null
     COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur"))
 }
 
+_hg_branches()
+{
+    local branches="$(_hg_cmd branches -q)"
+    local IFS=$'\n'
+    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$branches' -- "$cur"))
+}
+
 _hg_bookmarks()
 {
     local bookmarks="$(_hg_cmd bookmarks -q)"
@@ -117,25 +122,45 @@
     local filters="$1"
 
     for ((i=1; $i<=$COMP_CWORD; i++)); do
-	if [[ "${COMP_WORDS[i]}" != -* ]]; then
-	    if [[ ${COMP_WORDS[i-1]} == @($filters|$global_args) ]]; then
-		continue
-	    fi
-	    count=$(($count + 1))
-	fi
+        if [[ "${COMP_WORDS[i]}" != -* ]]; then
+            if [[ ${COMP_WORDS[i-1]} == @($filters|$global_args) ]]; then
+                continue
+            fi
+            count=$(($count + 1))
+        fi
     done
 
     echo $(($count - 1))
 }
 
+_hg_fix_wordlist()
+{
+    local LASTCHAR=' '
+    if [ ${#COMPREPLY[@]} = 1 ]; then
+        [ -d "$COMPREPLY" ] && LASTCHAR=/
+        COMPREPLY=$(printf %q%s "$COMPREPLY" "$LASTCHAR")
+    else
+        for ((i=0; i < ${#COMPREPLY[@]}; i++)); do
+            [ -d "${COMPREPLY[$i]}" ] && COMPREPLY[$i]=${COMPREPLY[$i]}/
+        done
+    fi
+}
+
 _hg()
 {
-    local cur prev cmd cmd_index opts i
+    local cur prev cmd cmd_index opts i aliashg
     # global options that receive an argument
     local global_args='--cwd|-R|--repository'
     local hg="$1"
     local canonical=0
 
+    aliashg=$(alias $hg 2>/dev/null)
+    if [[ -n "$aliashg" ]]; then
+      aliashg=${aliashg#"alias $hg='"}
+      aliashg=${aliashg%"'"}
+      hg=$aliashg
+    fi
+
     COMPREPLY=()
     cur="$2"
     prev="$3"
@@ -144,145 +169,169 @@
     # (first non-option argument that doesn't follow a global option that
     #  receives an argument)
     for ((i=1; $i<=$COMP_CWORD; i++)); do
-	if [[ ${COMP_WORDS[i]} != -* ]]; then
-	    if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then
-		cmd="${COMP_WORDS[i]}"
-		cmd_index=$i
-		break
-	    fi
-	fi
+        if [[ ${COMP_WORDS[i]} != -* ]]; then
+            if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then
+                cmd="${COMP_WORDS[i]}"
+                cmd_index=$i
+                break
+            fi
+        fi
     done
 
     if [[ "$cur" == -* ]]; then
-	if [ "$(type -t "_hg_opt_$cmd")" = function ] && "_hg_opt_$cmd"; then
-	    return
-	fi
+        if [ "$(type -t "_hg_opt_$cmd")" = function ] && "_hg_opt_$cmd"; then
+            _hg_fix_wordlist
+            return
+        fi
 
-	opts=$(_hg_cmd debugcomplete --options "$cmd")
+        opts=$(_hg_cmd debugcomplete --options "$cmd")
 
-	COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur"))
-	return
+        COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur"))
+        _hg_fix_wordlist
+        return
     fi
 
     # global options
     case "$prev" in
-	-R|--repository)
-	    _hg_paths
-	    _hg_repos
-	    return
-	;;
-	--cwd)
-	    # Stick with default bash completion
-	    return
-	;;
+        -R|--repository)
+            _hg_paths
+            _hg_repos
+            _hg_fix_wordlist
+            return
+        ;;
+        --cwd)
+            # Stick with default bash completion
+            _hg_fix_wordlist
+            return
+        ;;
     esac
 
     if [ -z "$cmd" ] || [ $COMP_CWORD -eq $i ]; then
-	_hg_commands
-	return
+        _hg_commands
+        _hg_fix_wordlist
+        return
     fi
 
     # try to generate completion candidates for whatever command the user typed
     local help
     if _hg_command_specific; then
-	return
+        _hg_fix_wordlist
+        return
     fi
 
     # canonicalize the command name and try again
     help=$(_hg_cmd help "$cmd")
     if [ $? -ne 0 ]; then
-	# Probably either the command doesn't exist or it's ambiguous
-	return
+        # Probably either the command doesn't exist or it's ambiguous
+        return
     fi
     cmd=${help#hg }
     cmd=${cmd%%[$' \n']*}
     canonical=1
     _hg_command_specific
+    _hg_fix_wordlist
 }
 
 _hg_command_specific()
 {
     if [ "$(type -t "_hg_cmd_$cmd")" = function ]; then
-	"_hg_cmd_$cmd"
-	return 0
+        "_hg_cmd_$cmd"
+        return 0
     fi
 
-    if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" == --rev ]; then
-	if [ $canonical = 1 ]; then
-	    _hg_labels
-	    return 0
-	elif [[ status != "$cmd"* ]]; then
-            _hg_labels
-	    return 0
-	else
-	    return 1
-	fi
+    if [ "$cmd" != status ]; then
+        case "$prev" in
+            -r|--rev)
+                if [[ $canonical = 1 || status != "$cmd"* ]]; then
+                    _hg_labels
+                    return 0
+                fi
+                return 1
+            ;;
+            -B|--bookmark)
+                if [[ $canonical = 1 || status != "$cmd"* ]]; then
+                    _hg_bookmarks
+                    return 0
+                fi
+                return 1
+            ;;
+            -b|--branch)
+                if [[ $canonical = 1 || status != "$cmd"* ]]; then
+                    _hg_branches
+                    return 0
+                fi
+                return 1
+            ;;
+        esac
     fi
 
+    local aliascmd=$(_hg_cmd showconfig alias.$cmd | awk '{print $1}')
+    [ -n "$aliascmd" ] && cmd=$aliascmd
+
     case "$cmd" in
-	help)
-	    _hg_commands
-	;;
-	export)
-	    if _hg_ext_mq_patchlist qapplied && [ "${COMPREPLY[*]}" ]; then
-		return 0
-	    fi
-	    _hg_labels
-	;;
-	manifest|update|up|checkout|co)
-	    _hg_labels
-	;;
-	pull|push|outgoing|incoming)
-	    _hg_paths
-	    _hg_repos
-	;;
-	paths)
-	    _hg_paths
-	;;
-	add)
-	    _hg_status "u"
-	;;
-	merge)
-	    _hg_labels
-	;;
-	commit|ci|record)
-	    _hg_status "mar"
-	;;
-	remove|rm)
-	    _hg_debugpathcomplete -n
-	;;
-	forget)
-	    _hg_debugpathcomplete -fa
-	;;
-	diff)
-	    _hg_status "mar"
-	;;
-	revert)
-	    _hg_debugpathcomplete
-	;;
-	clone)
-	    local count=$(_hg_count_non_option)
-	    if [ $count = 1 ]; then
-		_hg_paths
-	    fi
-	    _hg_repos
-	;;
-	debugindex|debugindexdot)
-	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.i" -- "$cur"))
-	;;
-	debugdata)
-	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.d" -- "$cur"))
-	;;
-	*)
-	    return 1
-	;;
+        help)
+            _hg_commands
+        ;;
+        export)
+            if _hg_ext_mq_patchlist qapplied && [ "${COMPREPLY[*]}" ]; then
+                return 0
+            fi
+            _hg_labels
+        ;;
+        manifest|update|up|checkout|co)
+            _hg_labels
+        ;;
+        pull|push|outgoing|incoming)
+            _hg_paths
+            _hg_repos
+        ;;
+        paths)
+            _hg_paths
+        ;;
+        add)
+            _hg_status "u"
+        ;;
+        merge)
+            _hg_labels
+        ;;
+        commit|ci|record)
+            _hg_status "mar"
+        ;;
+        remove|rm)
+            _hg_debugpathcomplete -n
+        ;;
+        forget)
+            _hg_debugpathcomplete -fa
+        ;;
+        diff)
+            _hg_status "mar"
+        ;;
+        revert)
+            _hg_debugpathcomplete
+        ;;
+        clone)
+            local count=$(_hg_count_non_option)
+            if [ $count = 1 ]; then
+                _hg_paths
+            fi
+            _hg_repos
+        ;;
+        debugindex|debugindexdot)
+            COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.i" -- "$cur"))
+        ;;
+        debugdata)
+            COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.d" -- "$cur"))
+        ;;
+        *)
+            return 1
+        ;;
     esac
 
     return 0
 }
 
-complete -o bashdefault -o default -F _hg hg \
-    || complete -o default -F _hg hg
+complete -o bashdefault -o default -o nospace -F _hg hg \
+    || complete -o default -o nospace -F _hg hg
 
 
 # Completion for commands provided by extensions
@@ -290,10 +339,8 @@
 # bookmarks
 _hg_cmd_bookmarks()
 {
-    if [[ "$prev" = @(-d|--delete|-m|--rename) ]]; then
-        _hg_bookmarks
-        return
-    fi
+    _hg_bookmarks
+    return
 }
 
 # mq
@@ -302,8 +349,8 @@
     local patches
     patches=$(_hg_cmd $1)
     if [ $? -eq 0 ] && [ "$patches" ]; then
-	COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$patches' -- "$cur"))
-	return 0
+        COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$patches' -- "$cur"))
+        return 0
     fi
     return 1
 }
@@ -313,19 +360,19 @@
     local root=$(_hg_cmd root)
     local n
     for n in $(cd "$root"/.hg && compgen -d -- "$cur"); do
-	# I think we're usually not interested in the regular "patches" queue
-	# so just filter it.
-	if [ "$n" != patches ] && [ -e "$root/.hg/$n/series" ]; then
-	    COMPREPLY=(${COMPREPLY[@]:-} "$n")
-	fi
+        # I think we're usually not interested in the regular "patches" queue
+        # so just filter it.
+        if [ "$n" != patches ] && [ -e "$root/.hg/$n/series" ]; then
+            COMPREPLY=(${COMPREPLY[@]:-} "$n")
+        fi
     done
 }
 
 _hg_cmd_qpop()
 {
     if [[ "$prev" = @(-n|--name) ]]; then
-	_hg_ext_mq_queues
-	return
+        _hg_ext_mq_queues
+        return
     fi
     _hg_ext_mq_patchlist qapplied
 }
@@ -333,8 +380,8 @@
 _hg_cmd_qpush()
 {
     if [[ "$prev" = @(-n|--name) ]]; then
-	_hg_ext_mq_queues
-	return
+        _hg_ext_mq_queues
+        return
     fi
     _hg_ext_mq_patchlist qunapplied
 }
@@ -342,8 +389,8 @@
 _hg_cmd_qgoto()
 {
     if [[ "$prev" = @(-n|--name) ]]; then
-	_hg_ext_mq_queues
-	return
+        _hg_ext_mq_queues
+        return
     fi
     _hg_ext_mq_patchlist qseries
 }
@@ -352,7 +399,7 @@
 {
     local qcmd=qunapplied
     if [[ "$prev" = @(-r|--rev) ]]; then
-	qcmd=qapplied
+        qcmd=qapplied
     fi
     _hg_ext_mq_patchlist $qcmd
 }
@@ -360,7 +407,7 @@
 _hg_cmd_qfinish()
 {
     if [[ "$prev" = @(-a|--applied) ]]; then
-	return
+        return
     fi
     _hg_ext_mq_patchlist qapplied
 }
@@ -368,8 +415,8 @@
 _hg_cmd_qsave()
 {
     if [[ "$prev" = @(-n|--name) ]]; then
-	_hg_ext_mq_queues
-	return
+        _hg_ext_mq_queues
+        return
     fi
 }
 
@@ -382,6 +429,10 @@
 
 _hg_cmd_strip()
 {
+    if [[ "$prev" = @(-B|--bookmark) ]]; then
+        _hg_bookmarks
+        return
+    fi
     _hg_labels
 }
 
@@ -412,7 +463,7 @@
 {
     local count=$(_hg_count_non_option)
     if [ $count = 1 ]; then
-	_hg_paths
+        _hg_paths
     fi
     _hg_repos
 }
@@ -433,15 +484,15 @@
     local prefix=''
 
     if [[ "$cur" == +* ]]; then
-	prefix=+
+        prefix=+
     elif [[ "$cur" == -* ]]; then
-	prefix=-
+        prefix=-
     fi
     local ncur=${cur#[-+]}
 
     if ! [ "$prefix" ]; then
-	_hg_ext_mq_patchlist qseries
-	return
+        _hg_ext_mq_patchlist qseries
+        return
     fi
 
     local guards=$(_hg_ext_mq_guards)
@@ -452,15 +503,15 @@
 {
     local i
     for ((i=cmd_index+1; i<=COMP_CWORD; i++)); do
-	if [[ ${COMP_WORDS[i]} != -* ]]; then
-	    if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then
-		_hg_cmd_qguard
-		return 0
-	    fi
-	elif [ "${COMP_WORDS[i]}" = -- ]; then
-	    _hg_cmd_qguard
-	    return 0
-	fi
+        if [[ ${COMP_WORDS[i]} != -* ]]; then
+            if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then
+                _hg_cmd_qguard
+                return 0
+            fi
+        elif [ "${COMP_WORDS[i]}" = -- ]; then
+            _hg_cmd_qguard
+            return 0
+        fi
     done
     return 1
 }
@@ -484,24 +535,24 @@
 
     # find the sub-command
     for ((i=cmd_index+1; i<=COMP_CWORD; i++)); do
-	if [[ ${COMP_WORDS[i]} != -* ]]; then
-	    if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then
-		subcmd="${COMP_WORDS[i]}"
-		break
-	    fi
-	fi
+        if [[ ${COMP_WORDS[i]} != -* ]]; then
+            if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then
+                subcmd="${COMP_WORDS[i]}"
+                break
+            fi
+        fi
     done
 
     if [ -z "$subcmd" ] || [ $COMP_CWORD -eq $i ] || [ "$subcmd" = help ]; then
-	COMPREPLY=(${COMPREPLY[@]:-}
-		   $(compgen -W 'bad good help init next reset' -- "$cur"))
-	return
+        COMPREPLY=(${COMPREPLY[@]:-}
+                   $(compgen -W 'bad good help init next reset' -- "$cur"))
+        return
     fi
 
     case "$subcmd" in
-	good|bad)
-	    _hg_labels
-	    ;;
+        good|bad)
+            _hg_labels
+            ;;
     esac
 
     return
@@ -512,28 +563,28 @@
 _hg_cmd_email()
 {
     case "$prev" in
-	-c|--cc|-t|--to|-f|--from|--bcc)
-	    # we need an e-mail address. let the user provide a function
-	    # to get them
-	    if [ "$(type -t _hg_emails)" = function ]; then
-		local arg=to
-		if [[ "$prev" == @(-f|--from) ]]; then
-		    arg=from
-		fi
-		local addresses=$(_hg_emails $arg)
-		COMPREPLY=(${COMPREPLY[@]:-}
-			   $(compgen -W '$addresses' -- "$cur"))
-	    fi
-	    return
-	    ;;
-	-m|--mbox)
-	    # fallback to standard filename completion
-	    return
-	    ;;
-	-s|--subject)
-	    # free form string
-	    return
-	    ;;
+        -c|--cc|-t|--to|-f|--from|--bcc)
+            # we need an e-mail address. let the user provide a function
+            # to get them
+            if [ "$(type -t _hg_emails)" = function ]; then
+                local arg=to
+                if [[ "$prev" == @(-f|--from) ]]; then
+                    arg=from
+                fi
+                local addresses=$(_hg_emails $arg)
+                COMPREPLY=(${COMPREPLY[@]:-}
+                           $(compgen -W '$addresses' -- "$cur"))
+            fi
+            return
+            ;;
+        -m|--mbox)
+            # fallback to standard filename completion
+            return
+            ;;
+        -s|--subject)
+            # free form string
+            return
+            ;;
     esac
 
     _hg_labels
@@ -552,15 +603,15 @@
 _hg_cmd_transplant()
 {
     case "$prev" in
-	-s|--source)
-	    _hg_paths
-	    _hg_repos
-	    return
-	    ;;
-	--filter)
-	    # standard filename completion
-	    return
-	    ;;
+        -s|--source)
+            _hg_paths
+            _hg_repos
+            return
+            ;;
+        --filter)
+            # standard filename completion
+            return
+            ;;
     esac
 
     # all other transplant options values and command parameters are revisions
@@ -571,14 +622,18 @@
 # shelve
 _hg_shelves()
 {
-    local shelves="$(_hg_cmd unshelve -l .)"
+    local shelves="$(_hg_cmd shelve -ql)"
     local IFS=$'\n'
     COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$shelves' -- "$cur"))
 }
 
 _hg_cmd_shelve()
 {
-    _hg_status "mard"
+    if [[ "$prev" = @(-d|--delete) ]]; then
+        _hg_shelves
+    else
+        _hg_status "mard"
+    fi
 }
 
 _hg_cmd_unshelve()
--- a/contrib/check-code.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/contrib/check-code.py	Fri Dec 13 17:23:02 2013 -0600
@@ -141,17 +141,15 @@
     (r'^  saved backup bundle to \$TESTTMP.*\.hg$', winglobmsg),
     (r'^  changeset .* references (corrupted|missing) \$TESTTMP/.*[^)]$',
      winglobmsg),
-    (r'^  pulling from \$TESTTMP/.*[^)]$', winglobmsg, '\$TESTTMP/unix-repo$'),
-    (r'^  reverting .*/.*[^)]$', winglobmsg, '\$TESTTMP/unix-repo$'),
-    (r'^  cloning subrepo \S+/.*[^)]$', winglobmsg, '\$TESTTMP/unix-repo$'),
-    (r'^  pushing to \$TESTTMP/.*[^)]$', winglobmsg, '\$TESTTMP/unix-repo$'),
-    (r'^  pushing subrepo \S+/\S+ to.*[^)]$', winglobmsg,
-     '\$TESTTMP/unix-repo$'),
+    (r'^  pulling from \$TESTTMP/.*[^)]$', winglobmsg,
+     '\$TESTTMP/unix-repo$'), # in test-issue1802.t which skipped on windows
+    (r'^  reverting .*/.*[^)]$', winglobmsg),
+    (r'^  cloning subrepo \S+/.*[^)]$', winglobmsg),
+    (r'^  pushing to \$TESTTMP/.*[^)]$', winglobmsg),
+    (r'^  pushing subrepo \S+/\S+ to.*[^)]$', winglobmsg),
     (r'^  moving \S+/.*[^)]$', winglobmsg),
-    (r'^  no changes made to subrepo since.*/.*[^)]$',
-     winglobmsg, '\$TESTTMP/unix-repo$'),
-    (r'^  .*: largefile \S+ not available from file:.*/.*[^)]$',
-     winglobmsg, '\$TESTTMP/unix-repo$'),
+    (r'^  no changes made to subrepo since.*/.*[^)]$', winglobmsg),
+    (r'^  .*: largefile \S+ not available from file:.*/.*[^)]$', winglobmsg),
   ],
   # warnings
   [
@@ -264,7 +262,7 @@
     (r'[\s\(](open|file)\([^)]*\)\.read\(',
      "use util.readfile() instead"),
     (r'[\s\(](open|file)\([^)]*\)\.write\(',
-     "use util.readfile() instead"),
+     "use util.writefile() instead"),
     (r'^[\s\(]*(open(er)?|file)\([^)]*\)',
      "always assign an opened file to a variable, and close it afterwards"),
     (r'[\s\(](open|file)\([^)]*\)\.',
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/editmerge	Fri Dec 13 17:23:02 2013 -0600
@@ -0,0 +1,58 @@
+#!/bin/bash
+# A simple script for opening merge conflicts in the editor.
+# Use the following Mercurial settings to enable it.
+#
+# [ui]
+# merge = editmerge
+#
+# [merge-tools]
+# editmerge.args=$output
+# editmerge.check=changed
+# editmerge.premerge=keep
+
+FILE=$1
+
+getlines() {
+  grep -n "<<<<<<" $FILE | cut -f1 -d:
+}
+
+# editor preference loosely based on http://mercurial.selenic.com/wiki/editor
+# hg showconfig is at the bottom though, since it's slow to run (0.15 seconds)
+ED=$HGEDITOR
+if [ "$ED" = "" ] ; then
+  ED=$VISUAL
+fi
+if [ "$ED" = "" ] ; then
+  ED=$EDITOR
+fi
+if [ "$ED" = "" ] ; then
+  ED=$(hg showconfig ui.editor)
+fi
+if [ "$ED" = "" ] ; then
+  echo "merge failed - unable to find editor"
+  exit 1
+fi
+
+if [ "$ED" = "emacs" ] || [ "$ED" = "nano" ] || [ "$ED" = "vim" ] ; then
+  FIRSTLINE=$(getlines | head -n 1)
+  PREVIOUSLINE=""
+
+  # open the editor to the first conflict until there are no more
+  # or the user stops editing the file
+  while [ ! "$FIRSTLINE" = "" ] && [ ! "$FIRSTLINE" = "$PREVIOUSLINE" ] ; do
+    $ED +$FIRSTLINE $FILE
+    PREVIOUSLINE=$FIRSTLINE
+    FIRSTLINE=$(getlines | head -n 1)
+  done
+else
+  $ED $FILE
+fi
+
+# get the line numbers of the remaining conflicts
+CONFLICTS=$(getlines | sed ':a;N;$!ba;s/\n/, /g')
+if [ ! "$CONFLICTS" = "" ] ; then
+  echo "merge failed - resolve the conflicts (line $CONFLICTS) then use 'hg resolve --mark'"
+  exit 1
+fi
+
+exit 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/import-checker.py	Fri Dec 13 17:23:02 2013 -0600
@@ -0,0 +1,221 @@
+import ast
+import os
+import sys
+
+def dotted_name_of_path(path):
+    """Given a relative path to a source file, return its dotted module name.
+
+
+    >>> dotted_name_of_path('mercurial/error.py')
+    'mercurial.error'
+    """
+    parts = path.split('/')
+    parts[-1] = parts[-1][:-3] # remove .py
+    return '.'.join(parts)
+
+
+def list_stdlib_modules():
+    """List the modules present in the stdlib.
+
+    >>> mods = set(list_stdlib_modules())
+    >>> 'BaseHTTPServer' in mods
+    True
+
+    os.path isn't really a module, so it's missing:
+
+    >>> 'os.path' in mods
+    False
+
+    sys requires special treatment, because it's baked into the
+    interpreter, but it should still appear:
+
+    >>> 'sys' in mods
+    True
+
+    >>> 'collections' in mods
+    True
+
+    >>> 'cStringIO' in mods
+    True
+    """
+    for m in sys.builtin_module_names:
+        yield m
+    # These modules only exist on windows, but we should always
+    # consider them stdlib.
+    for m in ['msvcrt', '_winreg']:
+        yield m
+    # These get missed too
+    for m in 'ctypes', 'email':
+        yield m
+    yield 'builtins' # python3 only
+    for libpath in sys.path:
+        # We want to walk everything in sys.path that starts with
+        # either sys.prefix or sys.exec_prefix.
+        if not (libpath.startswith(sys.prefix)
+                or libpath.startswith(sys.exec_prefix)):
+            continue
+        if 'site-packages' in libpath:
+            continue
+        for top, dirs, files in os.walk(libpath):
+            for name in files:
+                if name == '__init__.py':
+                    continue
+                if not (name.endswith('.py') or name.endswith('.so')):
+                    continue
+                full_path = os.path.join(top, name)
+                if 'site-packages' in full_path:
+                    continue
+                rel_path = full_path[len(libpath) + 1:]
+                mod = dotted_name_of_path(rel_path)
+                yield mod
+
+stdlib_modules = set(list_stdlib_modules())
+
+def imported_modules(source, ignore_nested=False):
+    """Given the source of a file as a string, yield the names
+    imported by that file.
+
+    Args:
+      source: The python source to examine as a string.
+      ignore_nested: If true, import statements that do not start in
+                     column zero will be ignored.
+
+    Returns:
+      A list of module names imported by the given source.
+
+    >>> sorted(imported_modules(
+    ...         'import foo ; from baz import bar; import foo.qux'))
+    ['baz.bar', 'foo', 'foo.qux']
+    >>> sorted(imported_modules(
+    ... '''import foo
+    ... def wat():
+    ...     import bar
+    ... ''', ignore_nested=True))
+    ['foo']
+    """
+    for node in ast.walk(ast.parse(source)):
+        if ignore_nested and getattr(node, 'col_offset', 0) > 0:
+            continue
+        if isinstance(node, ast.Import):
+            for n in node.names:
+                yield n.name
+        elif isinstance(node, ast.ImportFrom):
+            prefix = node.module + '.'
+            for n in node.names:
+                yield prefix + n.name
+
+def verify_stdlib_on_own_line(source):
+    """Given some python source, verify that stdlib imports are done
+    in separate statements from relative local module imports.
+
+    Observing this limitation is important as it works around an
+    annoying lib2to3 bug in relative import rewrites:
+    http://bugs.python.org/issue19510.
+
+    >>> list(verify_stdlib_on_own_line('import sys, foo'))
+    ['mixed stdlib and relative imports:\\n   foo, sys']
+    >>> list(verify_stdlib_on_own_line('import sys, os'))
+    []
+    >>> list(verify_stdlib_on_own_line('import foo, bar'))
+    []
+    """
+    for node in ast.walk(ast.parse(source)):
+        if isinstance(node, ast.Import):
+            from_stdlib = {}
+            for n in node.names:
+                from_stdlib[n.name] = n.name in stdlib_modules
+            num_std = len([x for x in from_stdlib.values() if x])
+            if num_std not in (len(from_stdlib.values()), 0):
+                yield ('mixed stdlib and relative imports:\n   %s' %
+                       ', '.join(sorted(from_stdlib.iterkeys())))
+
+class CircularImport(Exception):
+    pass
+
+
+def cyclekey(names):
+    return tuple(sorted(set(names)))
+
+def check_one_mod(mod, imports, path=None, ignore=None):
+    if path is None:
+        path = []
+    if ignore is None:
+        ignore = []
+    path = path + [mod]
+    for i in sorted(imports.get(mod, [])):
+        if i not in stdlib_modules:
+            i = mod.rsplit('.', 1)[0] + '.' + i
+        if i in path:
+            firstspot = path.index(i)
+            cycle = path[firstspot:] + [i]
+            if cyclekey(cycle) not in ignore:
+                raise CircularImport(cycle)
+            continue
+        check_one_mod(i, imports, path=path, ignore=ignore)
+
+def rotatecycle(cycle):
+    """arrange a cycle so that the lexicographically first module listed first
+
+    >>> rotatecycle(['foo', 'bar', 'foo'])
+    ['bar', 'foo', 'bar']
+    """
+    lowest = min(cycle)
+    idx = cycle.index(lowest)
+    return cycle[idx:] + cycle[1:idx] + [lowest]
+
+def find_cycles(imports):
+    """Find cycles in an already-loaded import graph.
+
+    >>> imports = {'top.foo': ['bar', 'os.path', 'qux'],
+    ...            'top.bar': ['baz', 'sys'],
+    ...            'top.baz': ['foo'],
+    ...            'top.qux': ['foo']}
+    >>> print '\\n'.join(sorted(find_cycles(imports)))
+    top.bar -> top.baz -> top.foo -> top.bar -> top.bar
+    top.foo -> top.qux -> top.foo -> top.foo
+    """
+    cycles = {}
+    for mod in sorted(imports.iterkeys()):
+        try:
+            check_one_mod(mod, imports, ignore=cycles)
+        except CircularImport, e:
+            cycle = e.args[0]
+            cycles[cyclekey(cycle)] = ' -> '.join(rotatecycle(cycle))
+    return cycles.values()
+
+def _cycle_sortkey(c):
+    return len(c), c
+
+def main(argv):
+    if len(argv) < 2:
+        print 'Usage: %s file [file] [file] ...'
+        return 1
+    used_imports = {}
+    any_errors = False
+    for source_path in argv[1:]:
+        f = open(source_path)
+        modname = dotted_name_of_path(source_path)
+        src = f.read()
+        used_imports[modname] = sorted(
+            imported_modules(src, ignore_nested=True))
+        for error in verify_stdlib_on_own_line(src):
+            any_errors = True
+            print source_path, error
+        f.close()
+    cycles = find_cycles(used_imports)
+    if cycles:
+        firstmods = set()
+        for c in sorted(cycles, key=_cycle_sortkey):
+            first = c.split()[0]
+            # As a rough cut, ignore any cycle that starts with the
+            # same module as some other cycle. Otherwise we see lots
+            # of cycles that are effectively duplicates.
+            if first in firstmods:
+                continue
+            print 'Import cycle:', c
+            firstmods.add(first)
+        any_errors = True
+    return not any_errors
+
+if __name__ == '__main__':
+    sys.exit(int(main(sys.argv)))
--- a/contrib/perf.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/contrib/perf.py	Fri Dec 13 17:23:02 2013 -0600
@@ -386,7 +386,7 @@
     allfilters = []
     while possiblefilters:
         for name in possiblefilters:
-            subset = repoview.subsettable.get(name)
+            subset = branchmap.subsettable.get(name)
             if subset not in possiblefilters:
                 break
         else:
--- a/doc/gendoc.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/doc/gendoc.py	Fri Dec 13 17:23:02 2013 -0600
@@ -40,11 +40,16 @@
             shortopt, longopt, default, desc, optlabel = opt
         else:
             shortopt, longopt, default, desc = opt
+            optlabel = _("VALUE")
         allopts = []
         if shortopt:
             allopts.append("-%s" % shortopt)
         if longopt:
             allopts.append("--%s" % longopt)
+        if isinstance(default, list):
+            allopts[-1] += " <%s[+]>" % optlabel
+        elif (default is not None) and not isinstance(default, bool):
+            allopts[-1] += " <%s>" % optlabel
         desc += default and _(" (default: %s)") % default or ""
         yield (", ".join(allopts), desc)
 
@@ -71,8 +76,14 @@
 def showdoc(ui):
     # print options
     ui.write(minirst.section(_("Options")))
+    multioccur = False
     for optstr, desc in get_opts(globalopts):
         ui.write("%s\n    %s\n\n" % (optstr, desc))
+        if optstr.endswith("[+]>"):
+            multioccur = True
+    if multioccur:
+        ui.write(_("\n[+] marked option can be specified multiple times\n"))
+        ui.write("\n")
 
     # print cmds
     ui.write(minirst.section(_("Commands")))
@@ -157,12 +168,18 @@
         if opt_output:
             opts_len = max([len(line[0]) for line in opt_output])
             ui.write(_("Options:\n\n"))
+            multioccur = False
             for optstr, desc in opt_output:
                 if desc:
                     s = "%-*s  %s" % (opts_len, optstr, desc)
                 else:
                     s = optstr
                 ui.write("%s\n" % s)
+                if optstr.endswith("[+]>"):
+                    multioccur = True
+            if multioccur:
+                ui.write(_("\n[+] marked option can be specified"
+                           " multiple times\n"))
             ui.write("\n")
         # aliases
         if d['aliases']:
--- a/hgext/convert/filemap.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/hgext/convert/filemap.py	Fri Dec 13 17:23:02 2013 -0600
@@ -10,12 +10,20 @@
 from mercurial import util, error
 from common import SKIPREV, converter_source
 
-def rpairs(name):
-    e = len(name)
-    while e != -1:
-        yield name[:e], name[e + 1:]
-        e = name.rfind('/', 0, e)
-    yield '.', name
+def rpairs(path):
+    '''Yield tuples with path split at '/', starting with the full path.
+    No leading, trailing or double '/', please.
+    >>> for x in rpairs('foo/bar/baz'): print x
+    ('foo/bar/baz', '')
+    ('foo/bar', 'baz')
+    ('foo', 'bar/baz')
+    ('.', 'foo/bar/baz')
+    '''
+    i = len(path)
+    while i != -1:
+        yield path[:i], path[i + 1:]
+        i = path.rfind('/', 0, i)
+    yield '.', path
 
 def normalize(path):
     ''' We use posixpath.normpath to support cross-platform path format.
--- a/hgext/graphlog.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/hgext/graphlog.py	Fri Dec 13 17:23:02 2013 -0600
@@ -5,7 +5,10 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-'''command to view revision graphs from a shell
+'''command to view revision graphs from a shell (DEPRECATED)
+
+The functionality of this extension has been include in core Mercurial
+since version 2.3.
 
 This extension adds a --graph option to the incoming, outgoing and log
 commands. When this options is given, an ASCII representation of the
--- a/hgext/keyword.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/hgext/keyword.py	Fri Dec 13 17:23:02 2013 -0600
@@ -84,7 +84,7 @@
 
 from mercurial import commands, context, cmdutil, dispatch, filelog, extensions
 from mercurial import localrepo, match, patch, templatefilters, templater, util
-from mercurial import scmutil
+from mercurial import scmutil, pathutil
 from mercurial.hgweb import webcommands
 from mercurial.i18n import _
 import os, re, shutil, tempfile
@@ -439,7 +439,11 @@
     repo[None].add([fn])
     ui.note(_('\nkeywords written to %s:\n') % fn)
     ui.note(keywords)
-    repo.dirstate.setbranch('demobranch')
+    wlock = repo.wlock()
+    try:
+        repo.dirstate.setbranch('demobranch')
+    finally:
+        wlock.release()
     for name, cmd in ui.configitems('hooks'):
         if name.split('.', 1)[0].find('commit') > -1:
             repo.ui.setconfig('hooks', name, '')
@@ -673,7 +677,7 @@
                 expansion. '''
                 source = repo.dirstate.copied(dest)
                 if 'l' in wctx.flags(source):
-                    source = scmutil.canonpath(repo.root, cwd,
+                    source = pathutil.canonpath(repo.root, cwd,
                                                os.path.realpath(source))
                 return kwt.match(source)
 
--- a/hgext/largefiles/overrides.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/hgext/largefiles/overrides.py	Fri Dec 13 17:23:02 2013 -0600
@@ -12,7 +12,7 @@
 import copy
 
 from mercurial import hg, commands, util, cmdutil, scmutil, match as match_, \
-    node, archival, error, merge, discovery
+    node, archival, error, merge, discovery, pathutil
 from mercurial.i18n import _
 from mercurial.node import hex
 from hgext import rebase
@@ -469,7 +469,7 @@
         return orig(ui, repo, pats, opts, rename)
 
     def makestandin(relpath):
-        path = scmutil.canonpath(repo.root, repo.getcwd(), relpath)
+        path = pathutil.canonpath(repo.root, repo.getcwd(), relpath)
         return os.path.join(repo.wjoin(lfutil.standin(path)))
 
     fullpats = scmutil.expandpats(pats)
--- a/hgext/mq.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/hgext/mq.py	Fri Dec 13 17:23:02 2013 -0600
@@ -1204,7 +1204,9 @@
         diffopts = self.diffopts()
         wlock = repo.wlock()
         try:
-            heads = [h for hs in repo.branchmap().itervalues() for h in hs]
+            heads = []
+            for hs in repo.branchmap().itervalues():
+                heads.extend(hs)
             if not heads:
                 heads = [nullid]
             if repo.dirstate.p1() not in heads and not exact:
@@ -2565,8 +2567,10 @@
         ph = patchheader(q.join(parent), q.plainmode)
         message, user = ph.message, ph.user
         for msg in messages:
-            message.append('* * *')
-            message.extend(msg)
+            if msg:
+                if message:
+                    message.append('* * *')
+                message.extend(msg)
         message = '\n'.join(message)
 
     if opts.get('edit'):
--- a/hgext/relink.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/hgext/relink.py	Fri Dec 13 17:23:02 2013 -0600
@@ -48,6 +48,10 @@
         ui.status(_('there is nothing to relink\n'))
         return
 
+    if not util.samedevice(src.store.path, repo.store.path):
+        # No point in continuing
+        raise util.Abort(_('source and destination are on different devices'))
+
     locallock = repo.lock()
     try:
         remotelock = src.lock()
--- a/hgext/strip.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/hgext/strip.py	Fri Dec 13 17:23:02 2013 -0600
@@ -182,37 +182,32 @@
 
         revs = sorted(rootnodes)
         if update and opts.get('keep'):
-            wlock = repo.wlock()
-            try:
-                urev, p2 = repo.changelog.parents(revs[0])
-                if (util.safehasattr(repo, 'mq') and p2 != nullid
-                    and p2 in [x.node for x in repo.mq.applied]):
-                    urev = p2
-                uctx = repo[urev]
+            urev, p2 = repo.changelog.parents(revs[0])
+            if (util.safehasattr(repo, 'mq') and p2 != nullid
+                and p2 in [x.node for x in repo.mq.applied]):
+                urev = p2
+            uctx = repo[urev]
 
-                # only reset the dirstate for files that would actually change
-                # between the working context and uctx
-                descendantrevs = repo.revs("%s::." % uctx.rev())
-                changedfiles = []
-                for rev in descendantrevs:
-                    # blindly reset the files, regardless of what actually
-                    # changed
-                    changedfiles.extend(repo[rev].files())
+            # only reset the dirstate for files that would actually change
+            # between the working context and uctx
+            descendantrevs = repo.revs("%s::." % uctx.rev())
+            changedfiles = []
+            for rev in descendantrevs:
+                # blindly reset the files, regardless of what actually changed
+                changedfiles.extend(repo[rev].files())
 
-                # reset files that only changed in the dirstate too
-                dirstate = repo.dirstate
-                dirchanges = [f for f in dirstate if dirstate[f] != 'n']
-                changedfiles.extend(dirchanges)
+            # reset files that only changed in the dirstate too
+            dirstate = repo.dirstate
+            dirchanges = [f for f in dirstate if dirstate[f] != 'n']
+            changedfiles.extend(dirchanges)
 
-                repo.dirstate.rebuild(urev, uctx.manifest(), changedfiles)
-                repo.dirstate.write()
-                update = False
-            finally:
-                wlock.release()
+            repo.dirstate.rebuild(urev, uctx.manifest(), changedfiles)
+            repo.dirstate.write()
+            update = False
 
         if opts.get('bookmark'):
             if mark == repo._bookmarkcurrent:
-                bookmarks.setcurrent(repo, None)
+                bookmarks.unsetcurrent(repo)
             del marks[mark]
             marks.write()
             ui.write(_("bookmark '%s' deleted\n") % mark)
--- a/hgext/transplant.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/hgext/transplant.py	Fri Dec 13 17:23:02 2013 -0600
@@ -154,7 +154,7 @@
                     # transplants before them fail.
                     domerge = True
                     if not hasnode(repo, node):
-                        repo.pull(source, heads=[node])
+                        repo.pull(source.peer(), heads=[node])
 
                 skipmerge = False
                 if parents[1] != revlog.nullid:
--- a/mercurial/ancestor.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/ancestor.py	Fri Dec 13 17:23:02 2013 -0600
@@ -5,7 +5,8 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-import heapq, util
+import heapq
+import util
 from node import nullrev
 
 def ancestors(pfunc, *orignodes):
--- a/mercurial/bookmarks.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/bookmarks.py	Fri Dec 13 17:23:02 2013 -0600
@@ -6,7 +6,7 @@
 # GNU General Public License version 2 or any later version.
 
 from mercurial.i18n import _
-from mercurial.node import hex
+from mercurial.node import hex, bin
 from mercurial import encoding, error, util, obsolete
 import errno
 
@@ -58,7 +58,7 @@
         '''
         repo = self._repo
         if repo._bookmarkcurrent not in self:
-            setcurrent(repo, None)
+            unsetcurrent(repo)
 
         wlock = repo.wlock()
         try:
@@ -106,13 +106,13 @@
     Set the name of the bookmark that we are on (hg update <bookmark>).
     The name is recorded in .hg/bookmarks.current
     '''
+    if mark not in repo._bookmarks:
+        raise AssertionError('bookmark %s does not exist!' % mark)
+
     current = repo._bookmarkcurrent
     if current == mark:
         return
 
-    if mark not in repo._bookmarks:
-        mark = ''
-
     wlock = repo.wlock()
     try:
         file = repo.opener('bookmarks.current', 'w', atomictemp=True)
@@ -239,49 +239,176 @@
     finally:
         w.release()
 
+def compare(repo, srcmarks, dstmarks,
+            srchex=None, dsthex=None, targets=None):
+    '''Compare bookmarks between srcmarks and dstmarks
+
+    This returns tuple "(addsrc, adddst, advsrc, advdst, diverge,
+    differ, invalid)", each are list of bookmarks below:
+
+    :addsrc:  added on src side (removed on dst side, perhaps)
+    :adddst:  added on dst side (removed on src side, perhaps)
+    :advsrc:  advanced on src side
+    :advdst:  advanced on dst side
+    :diverge: diverge
+    :differ:  changed, but changeset referred on src is unknown on dst
+    :invalid: unknown on both side
+
+    Each elements of lists in result tuple is tuple "(bookmark name,
+    changeset ID on source side, changeset ID on destination
+    side)". Each changeset IDs are 40 hexadecimal digit string or
+    None.
+
+    Changeset IDs of tuples in "addsrc", "adddst", "differ" or
+     "invalid" list may be unknown for repo.
+
+    This function expects that "srcmarks" and "dstmarks" return
+    changeset ID in 40 hexadecimal digit string for specified
+    bookmark. If not so (e.g. bmstore "repo._bookmarks" returning
+    binary value), "srchex" or "dsthex" should be specified to convert
+    into such form.
+
+    If "targets" is specified, only bookmarks listed in it are
+    examined.
+    '''
+    if not srchex:
+        srchex = lambda x: x
+    if not dsthex:
+        dsthex = lambda x: x
+
+    if targets:
+        bset = set(targets)
+    else:
+        srcmarkset = set(srcmarks)
+        dstmarkset = set(dstmarks)
+        bset = srcmarkset ^ dstmarkset
+        for b in srcmarkset & dstmarkset:
+            if srchex(srcmarks[b]) != dsthex(dstmarks[b]):
+                bset.add(b)
+
+    results = ([], [], [], [], [], [], [])
+    addsrc = results[0].append
+    adddst = results[1].append
+    advsrc = results[2].append
+    advdst = results[3].append
+    diverge = results[4].append
+    differ = results[5].append
+    invalid = results[6].append
+
+    for b in sorted(bset):
+        if b not in srcmarks:
+            if b in dstmarks:
+                adddst((b, None, dsthex(dstmarks[b])))
+            else:
+                invalid((b, None, None))
+        elif b not in dstmarks:
+            addsrc((b, srchex(srcmarks[b]), None))
+        else:
+            scid = srchex(srcmarks[b])
+            dcid = dsthex(dstmarks[b])
+            if scid in repo and dcid in repo:
+                sctx = repo[scid]
+                dctx = repo[dcid]
+                if sctx.rev() < dctx.rev():
+                    if validdest(repo, sctx, dctx):
+                        advdst((b, scid, dcid))
+                    else:
+                        diverge((b, scid, dcid))
+                else:
+                    if validdest(repo, dctx, sctx):
+                        advsrc((b, scid, dcid))
+                    else:
+                        diverge((b, scid, dcid))
+            else:
+                # it is too expensive to examine in detail, in this case
+                differ((b, scid, dcid))
+
+    return results
+
+def _diverge(ui, b, path, localmarks):
+    if b == '@':
+        b = ''
+    # find a unique @ suffix
+    for x in range(1, 100):
+        n = '%s@%d' % (b, x)
+        if n not in localmarks:
+            break
+    # try to use an @pathalias suffix
+    # if an @pathalias already exists, we overwrite (update) it
+    for p, u in ui.configitems("paths"):
+        if path == u:
+            n = '%s@%s' % (b, p)
+    return n
+
 def updatefromremote(ui, repo, remotemarks, path):
     ui.debug("checking for updated bookmarks\n")
-    changed = False
     localmarks = repo._bookmarks
-    for k in sorted(remotemarks):
-        if k in localmarks:
-            nr, nl = remotemarks[k], localmarks[k]
-            if nr in repo:
-                cr = repo[nr]
-                cl = repo[nl]
-                if cl.rev() >= cr.rev():
-                    continue
-                if validdest(repo, cl, cr):
-                    localmarks[k] = cr.node()
-                    changed = True
-                    ui.status(_("updating bookmark %s\n") % k)
-                else:
-                    if k == '@':
-                        kd = ''
-                    else:
-                        kd = k
-                    # find a unique @ suffix
-                    for x in range(1, 100):
-                        n = '%s@%d' % (kd, x)
-                        if n not in localmarks:
-                            break
-                    # try to use an @pathalias suffix
-                    # if an @pathalias already exists, we overwrite (update) it
-                    for p, u in ui.configitems("paths"):
-                        if path == u:
-                            n = '%s@%s' % (kd, p)
+    (addsrc, adddst, advsrc, advdst, diverge, differ, invalid
+     ) = compare(repo, remotemarks, localmarks, dsthex=hex)
+
+    changed = []
+    for b, scid, dcid in addsrc:
+        if scid in repo: # add remote bookmarks for changes we already have
+            changed.append((b, bin(scid), ui.status,
+                            _("adding remote bookmark %s\n") % (b)))
+    for b, scid, dcid in advsrc:
+        changed.append((b, bin(scid), ui.status,
+                        _("updating bookmark %s\n") % (b)))
+    for b, scid, dcid in diverge:
+        db = _diverge(ui, b, path, localmarks)
+        changed.append((db, bin(scid), ui.warn,
+                        _("divergent bookmark %s stored as %s\n") % (b, db)))
+    if changed:
+        for b, node, writer, msg in sorted(changed):
+            localmarks[b] = node
+            writer(msg)
+        localmarks.write()
+
+def updateremote(ui, repo, remote, revs):
+    ui.debug("checking for updated bookmarks\n")
+    revnums = map(repo.changelog.rev, revs or [])
+    ancestors = [a for a in repo.changelog.ancestors(revnums, inclusive=True)]
+    (addsrc, adddst, advsrc, advdst, diverge, differ, invalid
+     ) = compare(repo, repo._bookmarks, remote.listkeys('bookmarks'),
+                 srchex=hex)
 
-                    localmarks[n] = cr.node()
-                    changed = True
-                    ui.warn(_("divergent bookmark %s stored as %s\n") % (k, n))
-        elif remotemarks[k] in repo:
-            # add remote bookmarks for changes we already have
-            localmarks[k] = repo[remotemarks[k]].node()
-            changed = True
-            ui.status(_("adding remote bookmark %s\n") % k)
+    for b, scid, dcid in advsrc:
+        if ancestors and repo[scid].rev() not in ancestors:
+            continue
+        if remote.pushkey('bookmarks', b, dcid, scid):
+            ui.status(_("updating bookmark %s\n") % b)
+        else:
+            ui.warn(_('updating bookmark %s failed!\n') % b)
+
+def pushtoremote(ui, repo, remote, targets):
+    (addsrc, adddst, advsrc, advdst, diverge, differ, invalid
+     ) = compare(repo, repo._bookmarks, remote.listkeys('bookmarks'),
+                 srchex=hex, targets=targets)
+    if invalid:
+        b, scid, dcid = invalid[0]
+        ui.warn(_('bookmark %s does not exist on the local '
+                  'or remote repository!\n') % b)
+        return 2
 
-    if changed:
-        localmarks.write()
+    def push(b, old, new):
+        r = remote.pushkey('bookmarks', b, old, new)
+        if not r:
+            ui.warn(_('updating bookmark %s failed!\n') % b)
+            return 1
+        return 0
+    failed = 0
+    for b, scid, dcid in sorted(addsrc + advsrc + advdst + diverge + differ):
+        ui.status(_("exporting bookmark %s\n") % b)
+        if dcid is None:
+            dcid = ''
+        failed += push(b, dcid, scid)
+    for b, scid, dcid in adddst:
+        # treat as "deleted locally"
+        ui.status(_("deleting remote bookmark %s\n") % b)
+        failed += push(b, dcid, '')
+
+    if failed:
+        return 1
 
 def diff(ui, dst, src):
     ui.status(_("searching for changed bookmarks\n"))
--- a/mercurial/branchmap.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/branchmap.py	Fri Dec 13 17:23:02 2013 -0600
@@ -7,7 +7,7 @@
 
 from node import bin, hex, nullid, nullrev
 import encoding
-import util, repoview
+import util
 
 def _filename(repo):
     """name of a branchcache file for a given repo or repoview"""
@@ -58,6 +58,17 @@
 
 
 
+### Nearest subset relation
+# Nearest subset of filter X is a filter Y so that:
+# * Y is included in X,
+# * X - Y is as small as possible.
+# This create and ordering used for branchmap purpose.
+# the ordering may be partial
+subsettable = {None: 'visible',
+               'visible': 'served',
+               'served': 'immutable',
+               'immutable': 'base'}
+
 def updatecache(repo):
     cl = repo.changelog
     filtername = repo.filtername
@@ -67,7 +78,7 @@
     if partial is None or not partial.validfor(repo):
         partial = read(repo)
         if partial is None:
-            subsetname = repoview.subsettable.get(filtername)
+            subsetname = subsettable.get(filtername)
             if subsetname is None:
                 partial = branchcache()
             else:
--- a/mercurial/cmdutil.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/cmdutil.py	Fri Dec 13 17:23:02 2013 -0600
@@ -10,7 +10,7 @@
 import os, sys, errno, re, tempfile
 import util, scmutil, templater, patch, error, templatekw, revlog, copies
 import match as matchmod
-import subrepo, context, repair, graphmod, revset, phases, obsolete
+import subrepo, context, repair, graphmod, revset, phases, obsolete, pathutil
 import changelog
 import bookmarks
 import lock as lockmod
@@ -274,7 +274,7 @@
     # relsrc: ossep
     # otarget: ossep
     def copyfile(abssrc, relsrc, otarget, exact):
-        abstarget = scmutil.canonpath(repo.root, cwd, otarget)
+        abstarget = pathutil.canonpath(repo.root, cwd, otarget)
         if '/' in abstarget:
             # We cannot normalize abstarget itself, this would prevent
             # case only renames, like a => A.
@@ -367,7 +367,7 @@
     # return: function that takes hgsep and returns ossep
     def targetpathfn(pat, dest, srcs):
         if os.path.isdir(pat):
-            abspfx = scmutil.canonpath(repo.root, cwd, pat)
+            abspfx = pathutil.canonpath(repo.root, cwd, pat)
             abspfx = util.localpath(abspfx)
             if destdirexists:
                 striplen = len(os.path.split(abspfx)[0])
@@ -393,7 +393,7 @@
             res = lambda p: os.path.join(dest,
                                          os.path.basename(util.localpath(p)))
         else:
-            abspfx = scmutil.canonpath(repo.root, cwd, pat)
+            abspfx = pathutil.canonpath(repo.root, cwd, pat)
             if len(abspfx) < len(srcs[0][0]):
                 # A directory. Either the target path contains the last
                 # component of the source path or it does not.
@@ -2063,7 +2063,7 @@
                 fc = ctx[f]
                 repo.wwrite(f, fc.data(), fc.flags())
 
-            audit_path = scmutil.pathauditor(repo.root)
+            audit_path = pathutil.pathauditor(repo.root)
             for f in remove[0]:
                 if repo.dirstate[f] == 'a':
                     repo.dirstate.drop(f)
--- a/mercurial/commands.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/commands.py	Fri Dec 13 17:23:02 2013 -0600
@@ -17,7 +17,8 @@
 import merge as mergemod
 import minirst, revset, fileset
 import dagparser, context, simplemerge, graphmod
-import random, setdiscovery, treediscovery, dagutil, pvec, localrepo
+import random
+import setdiscovery, treediscovery, dagutil, pvec, localrepo
 import phases, obsolete
 
 table = {}
@@ -700,7 +701,7 @@
                 ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition))
                 check_state(state, interactive=False)
                 # bisect
-                nodes, changesets, good = hbisect.bisect(repo.changelog, state)
+                nodes, changesets, bgood = hbisect.bisect(repo.changelog, state)
                 # update to next check
                 node = nodes[0]
                 if not noupdate:
@@ -709,7 +710,7 @@
         finally:
             state['current'] = [node]
             hbisect.save_state(repo, state)
-        print_result(nodes, good)
+        print_result(nodes, bgood)
         return
 
     # update state
@@ -866,7 +867,7 @@
             if mark not in marks:
                 raise util.Abort(_("bookmark '%s' does not exist") % mark)
             if mark == repo._bookmarkcurrent:
-                bookmarks.setcurrent(repo, None)
+                bookmarks.unsetcurrent(repo)
             del marks[mark]
         marks.write()
 
@@ -892,7 +893,7 @@
             if newact is None:
                 newact = mark
             if inactive and mark == repo._bookmarkcurrent:
-                bookmarks.setcurrent(repo, None)
+                bookmarks.unsetcurrent(repo)
                 return
             tgt = cur
             if rev:
@@ -902,7 +903,7 @@
         if not inactive and cur == marks[newact] and not rev:
             bookmarks.setcurrent(repo, newact)
         elif cur != tgt and newact == repo._bookmarkcurrent:
-            bookmarks.setcurrent(repo, None)
+            bookmarks.unsetcurrent(repo)
         marks.write()
 
     # Same message whether trying to deactivate the current bookmark (-i
@@ -914,7 +915,7 @@
         if not repo._bookmarkcurrent:
             ui.status(_("no active bookmark\n"))
         else:
-            bookmarks.setcurrent(repo, None)
+            bookmarks.unsetcurrent(repo)
 
     else: # show bookmarks
         for bmark, n in sorted(marks.iteritems()):
@@ -2244,7 +2245,7 @@
                     continue
                 s = f.find(os.sep, speclen)
                 if s >= 0:
-                    adddir(f[:s + 1])
+                    adddir(f[:s])
                 else:
                     addfile(f)
         return files, dirs
@@ -2265,10 +2266,6 @@
         f, d = complete(spec, acceptable or 'nmar')
         files.update(f)
         dirs.update(d)
-    if not files and len(dirs) == 1:
-        # force the shell to consider a completion that matches one
-        # directory and zero files to be ambiguous
-        dirs.add(iter(dirs).next() + '.')
     files.update(dirs)
     ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
     ui.write('\n')
@@ -3762,12 +3759,12 @@
                                         files, eolmode=None)
                     except patch.PatchError, e:
                         raise util.Abort(str(e))
-                    memctx = patch.makememctx(repo, (p1.node(), p2.node()),
-                                              message,
-                                              opts.get('user') or user,
-                                              opts.get('date') or date,
-                                              branch, files, store,
-                                              editor=cmdutil.commiteditor)
+                    memctx = context.makememctx(repo, (p1.node(), p2.node()),
+                                                message,
+                                                opts.get('user') or user,
+                                                opts.get('date') or date,
+                                                branch, files, store,
+                                                editor=cmdutil.commiteditor)
                     repo.savecommitmessage(memctx.description())
                     n = memctx.commit()
                 finally:
@@ -4713,25 +4710,11 @@
     result = not result
 
     if opts.get('bookmark'):
-        rb = other.listkeys('bookmarks')
-        for b in opts['bookmark']:
-            # explicit push overrides remote bookmark if any
-            if b in repo._bookmarks:
-                ui.status(_("exporting bookmark %s\n") % b)
-                new = repo[b].hex()
-            elif b in rb:
-                ui.status(_("deleting remote bookmark %s\n") % b)
-                new = '' # delete
-            else:
-                ui.warn(_('bookmark %s does not exist on the local '
-                          'or remote repository!\n') % b)
-                return 2
-            old = rb.get(b, '')
-            r = other.pushkey('bookmarks', b, old, new)
-            if not r:
-                ui.warn(_('updating bookmark %s failed!\n') % b)
-                if not result:
-                    result = 2
+        bresult = bookmarks.pushtoremote(ui, repo, other, opts['bookmark'])
+        if bresult == 2:
+            return 2
+        if not result and bresult:
+            result = 2
 
     return result
 
--- a/mercurial/commandserver.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/commandserver.py	Fri Dec 13 17:23:02 2013 -0600
@@ -184,7 +184,10 @@
         # persist between requests
         copiedui = self.ui.copy()
         self.repo.baseui = copiedui
-        self.repo.ui = self.repo.dirstate._ui = self.repoui.copy()
+        # clone ui without using ui.copy because this is protected
+        repoui = self.repoui.__class__(self.repoui)
+        repoui.copy = copiedui.copy # redo copy protection
+        self.repo.ui = self.repo.dirstate._ui = repoui
         self.repo.invalidate()
         self.repo.invalidatedirstate()
 
--- a/mercurial/context.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/context.py	Fri Dec 13 17:23:02 2013 -0600
@@ -195,6 +195,21 @@
     def dirty(self):
         return False
 
+def makememctx(repo, parents, text, user, date, branch, files, store,
+               editor=None):
+    def getfilectx(repo, memctx, path):
+        data, (islink, isexec), copied = store.getfile(path)
+        return memfilectx(path, data, islink=islink, isexec=isexec,
+                                  copied=copied)
+    extra = {}
+    if branch:
+        extra['branch'] = encoding.fromlocal(branch)
+    ctx =  memctx(repo, parents, text, files, getfilectx, user,
+                          date, extra)
+    if editor:
+        ctx._text = editor(repo, ctx, [])
+    return ctx
+
 class changectx(basectx):
     """A changecontext object makes access to data related to a particular
     changeset convenient. It represents a read-only context already present in
--- a/mercurial/dirstate.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/dirstate.py	Fri Dec 13 17:23:02 2013 -0600
@@ -8,7 +8,7 @@
 
 from node import nullid
 from i18n import _
-import scmutil, util, ignore, osutil, parsers, encoding
+import scmutil, util, ignore, osutil, parsers, encoding, pathutil
 import os, stat, errno, gc
 
 propertycache = util.propertycache
@@ -736,7 +736,7 @@
                 # unknown == True means we walked the full directory tree above.
                 # So if a file is not seen it was either a) not matching matchfn
                 # b) ignored, c) missing, or d) under a symlink directory.
-                audit_path = scmutil.pathauditor(self._root)
+                audit_path = pathutil.pathauditor(self._root)
 
                 for nf in iter(visit):
                     # Report ignored items in the dmap as long as they are not
--- a/mercurial/discovery.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/discovery.py	Fri Dec 13 17:23:02 2013 -0600
@@ -313,8 +313,8 @@
             if 1 < len(newhs):
                 dhs = list(newhs)
                 if error is None:
-                    error = (_("push creates multiple headed new branch '%s'")
-                             % (branch))
+                    error = (_("push creates new branch '%s' "
+                               "with multiple heads") % (branch))
                     hint = _("merge or"
                              " see \"hg help push\" for details about"
                              " pushing new heads")
@@ -337,10 +337,12 @@
                     hint = _("merge or"
                              " see \"hg help push\" for details about"
                              " pushing new heads")
-            if branch is not None:
-                repo.ui.note(_("new remote heads on branch '%s'\n") % branch)
+            if branch is None:
+                repo.ui.note(_("new remote heads:\n"))
+            else:
+                repo.ui.note(_("new remote heads on branch '%s':\n") % branch)
             for h in dhs:
-                repo.ui.note(_("new remote head %s\n") % short(h))
+                repo.ui.note((" %s\n") % short(h))
     if error:
         raise util.Abort(error, hint=hint)
 
--- a/mercurial/dispatch.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/dispatch.py	Fri Dec 13 17:23:02 2013 -0600
@@ -106,8 +106,9 @@
                 for cfg in cfgs:
                     req.repo.ui.setconfig(*cfg)
 
+            # if we are in HGPLAIN mode, then disable custom debugging
             debugger = ui.config("ui", "debugger")
-            if not debugger:
+            if not debugger or ui.plain():
                 debugger = 'pdb'
 
             try:
--- a/mercurial/fancyopts.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/fancyopts.py	Fri Dec 13 17:23:02 2013 -0600
@@ -5,7 +5,8 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-import getopt, util
+import getopt
+import util
 from i18n import _
 
 def gnugetopt(args, options, longoptions):
--- a/mercurial/fileset.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/fileset.py	Fri Dec 13 17:23:02 2013 -0600
@@ -5,7 +5,8 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-import parser, error, util, merge, re
+import re
+import parser, error, util, merge
 from i18n import _
 
 elements = {
--- a/mercurial/hbisect.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/hbisect.py	Fri Dec 13 17:23:02 2013 -0600
@@ -8,7 +8,8 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-import os, error
+import os
+import error
 from i18n import _
 from node import short, hex
 import util
--- a/mercurial/help.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/help.py	Fri Dec 13 17:23:02 2013 -0600
@@ -6,7 +6,8 @@
 # GNU General Public License version 2 or any later version.
 
 from i18n import gettext, _
-import itertools, sys, os, error
+import itertools, sys, os
+import error
 import extensions, revset, fileset, templatekw, templatefilters, filemerge
 import encoding, util, minirst
 import cmdutil
--- a/mercurial/help/templates.txt	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/help/templates.txt	Fri Dec 13 17:23:02 2013 -0600
@@ -102,3 +102,7 @@
 - Invert the firstline filter, i.e. everything but the first line::
 
    $ hg log -r 0 --template "{sub(r'^.*\n?\n?', '', desc)}\n"
+
+- Display the contents of the 'extra' field, one per line::
+
+  $ hg log -r 0 --template "{join(extras, '\n')}\n"
--- a/mercurial/hg.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/hg.py	Fri Dec 13 17:23:02 2013 -0600
@@ -202,19 +202,20 @@
         hardlink = None
         num = 0
         srcpublishing = srcrepo.ui.configbool('phases', 'publish', True)
+        srcvfs = scmutil.vfs(srcrepo.sharedpath)
+        dstvfs = scmutil.vfs(destpath)
         for f in srcrepo.store.copylist():
             if srcpublishing and f.endswith('phaseroots'):
                 continue
-            src = os.path.join(srcrepo.sharedpath, f)
-            dst = os.path.join(destpath, f)
-            dstbase = os.path.dirname(dst)
-            if dstbase and not os.path.exists(dstbase):
-                os.mkdir(dstbase)
-            if os.path.exists(src):
-                if dst.endswith('data'):
+            dstbase = os.path.dirname(f)
+            if dstbase and not dstvfs.exists(dstbase):
+                dstvfs.mkdir(dstbase)
+            if srcvfs.exists(f):
+                if f.endswith('data'):
                     # lock to avoid premature writing to the target
-                    destlock = lock.lock(os.path.join(dstbase, "lock"))
-                hardlink, n = util.copyfiles(src, dst, hardlink)
+                    destlock = lock.lock(dstvfs, dstbase + "/lock")
+                hardlink, n = util.copyfiles(srcvfs.join(f), dstvfs.join(f),
+                                             hardlink)
                 num += n
         if hardlink:
             ui.debug("linked %d files\n" % num)
@@ -511,11 +512,7 @@
             return subreporecurse()
 
         displayer = cmdutil.show_changeset(ui, other, opts, buffered)
-
-        # XXX once graphlog extension makes it into core,
-        # should be replaced by a if graph/else
         displaychlist(other, chlist, displayer)
-
         displayer.close()
     finally:
         cleanupfn()
--- a/mercurial/hgweb/hgweb_mod.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/hgweb/hgweb_mod.py	Fri Dec 13 17:23:02 2013 -0600
@@ -6,7 +6,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-import os
+import os, re
 from mercurial import ui, hg, hook, error, encoding, templater, util, repoview
 from mercurial.templatefilters import websub
 from mercurial.i18n import _
@@ -14,7 +14,7 @@
 from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST
 from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR
 from request import wsgirequest
-import webcommands, protocol, webutil, re
+import webcommands, protocol, webutil
 
 perms = {
     'changegroup': 'pull',
--- a/mercurial/hgweb/webcommands.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/hgweb/webcommands.py	Fri Dec 13 17:23:02 2013 -0600
@@ -845,15 +845,11 @@
     end = min(count, start + revcount) # last rev on this page
     parity = paritygen(web.stripecount, offset=start - end)
 
-    def entries(latestonly, **map):
+    def entries():
         l = []
 
         repo = web.repo
-        revs = repo.changelog.revs(start, end - 1)
-        if latestonly:
-            for r in revs:
-                pass
-            revs = (r,)
+        revs = fctx.filelog().revs(start, end - 1)
         for i in revs:
             iterfctx = fctx.filectx(i)
 
@@ -877,11 +873,14 @@
         for e in reversed(l):
             yield e
 
+    entries = list(entries())
+    latestentry = entries[:1]
+
     revnav = webutil.filerevnav(web.repo, fctx.path())
     nav = revnav.gen(end - 1, revcount, count)
     return tmpl("filelog", file=f, node=fctx.hex(), nav=nav,
-                entries=lambda **x: entries(latestonly=False, **x),
-                latestentry=lambda **x: entries(latestonly=True, **x),
+                entries=entries,
+                latestentry=latestentry,
                 revcount=revcount, morevars=morevars, lessvars=lessvars)
 
 def archive(web, req, tmpl):
--- a/mercurial/hgweb/webutil.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/hgweb/webutil.py	Fri Dec 13 17:23:02 2013 -0600
@@ -7,7 +7,7 @@
 # GNU General Public License version 2 or any later version.
 
 import os, copy
-from mercurial import match, patch, scmutil, error, ui, util
+from mercurial import match, patch, error, ui, util, pathutil
 from mercurial.i18n import _
 from mercurial.node import hex, nullid
 from common import ErrorResponse
@@ -196,7 +196,7 @@
 
 def cleanpath(repo, path):
     path = path.lstrip('/')
-    return scmutil.canonpath(repo.root, '', path)
+    return pathutil.canonpath(repo.root, '', path)
 
 def changeidctx (repo, changeid):
     try:
--- a/mercurial/localrepo.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/localrepo.py	Fri Dec 13 17:23:02 2013 -0600
@@ -8,14 +8,15 @@
 from i18n import _
 import peer, changegroup, subrepo, discovery, pushkey, obsolete, repoview
 import changelog, dirstate, filelog, manifest, context, bookmarks, phases
-import lock, transaction, store, encoding
+import lock as lockmod
+import transaction, store, encoding
 import scmutil, util, extensions, hook, error, revset
 import match as matchmod
 import merge as mergemod
 import tags as tagsmod
 from lock import release
 import weakref, errno, os, time, inspect
-import branchmap
+import branchmap, pathutil
 propertycache = util.propertycache
 filecache = scmutil.filecache
 
@@ -166,11 +167,12 @@
         self.root = self.wvfs.base
         self.path = self.wvfs.join(".hg")
         self.origroot = path
-        self.auditor = scmutil.pathauditor(self.root, self._checknested)
+        self.auditor = pathutil.pathauditor(self.root, self._checknested)
         self.vfs = scmutil.vfs(self.path)
         self.opener = self.vfs
         self.baseui = baseui
         self.ui = baseui.copy()
+        self.ui.copy = baseui.copy # prevent copying repo configuration
         # A list of callback to shape the phase if no data were found.
         # Callback are in the form: func(repo, roots) --> processed root.
         # This list it to be filled by extension during repo setup
@@ -832,7 +834,7 @@
         renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
         rp = report and report or self.ui.warn
         tr = transaction.transaction(rp, self.sopener,
-                                     self.sjoin("journal"),
+                                     "journal",
                                      aftertrans(renames),
                                      self.store.createmode)
         self._transref = weakref.ref(tr)
@@ -866,7 +868,7 @@
         try:
             if self.svfs.exists("journal"):
                 self.ui.status(_("rolling back interrupted transaction\n"))
-                transaction.rollback(self.sopener, self.sjoin("journal"),
+                transaction.rollback(self.sopener, "journal",
                                      self.ui.warn)
                 self.invalidate()
                 return True
@@ -922,7 +924,7 @@
 
         parents = self.dirstate.parents()
         self.destroying()
-        transaction.rollback(self.sopener, self.sjoin('undo'), ui.warn)
+        transaction.rollback(self.sopener, 'undo', ui.warn)
         if self.vfs.exists('undo.bookmarks'):
             self.vfs.rename('undo.bookmarks', 'bookmarks')
         if self.svfs.exists('undo.phaseroots'):
@@ -998,17 +1000,18 @@
                 pass
         self.invalidatecaches()
 
-    def _lock(self, lockname, wait, releasefn, acquirefn, desc):
+    def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc):
         try:
-            l = lock.lock(lockname, 0, releasefn, desc=desc)
+            l = lockmod.lock(vfs, lockname, 0, releasefn, desc=desc)
         except error.LockHeld, inst:
             if not wait:
                 raise
             self.ui.warn(_("waiting for lock on %s held by %r\n") %
                          (desc, inst.locker))
             # default to 600 seconds timeout
-            l = lock.lock(lockname, int(self.ui.config("ui", "timeout", "600")),
-                          releasefn, desc=desc)
+            l = lockmod.lock(vfs, lockname,
+                             int(self.ui.config("ui", "timeout", "600")),
+                             releasefn, desc=desc)
         if acquirefn:
             acquirefn()
         return l
@@ -1041,7 +1044,7 @@
                     continue
                 ce.refresh()
 
-        l = self._lock(self.sjoin("lock"), wait, unlock,
+        l = self._lock(self.svfs, "lock", wait, unlock,
                        self.invalidate, _('repository %s') % self.origroot)
         self._lockref = weakref.ref(l)
         return l
@@ -1059,7 +1062,7 @@
             self.dirstate.write()
             self._filecache['dirstate'].refresh()
 
-        l = self._lock(self.join("wlock"), wait, unlock,
+        l = self._lock(self.vfs, "wlock", wait, unlock,
                        self.invalidatedirstate, _('working directory of %s') %
                        self.origroot)
         self._wlockref = weakref.ref(l)
@@ -1976,27 +1979,7 @@
             if locallock is not None:
                 locallock.release()
 
-        self.ui.debug("checking for updated bookmarks\n")
-        rb = remote.listkeys('bookmarks')
-        revnums = map(unfi.changelog.rev, revs or [])
-        ancestors = [
-            a for a in unfi.changelog.ancestors(revnums, inclusive=True)]
-        for k in rb.keys():
-            if k in unfi._bookmarks:
-                nr, nl = rb[k], hex(self._bookmarks[k])
-                if nr in unfi:
-                    cr = unfi[nr]
-                    cl = unfi[nl]
-                    if bookmarks.validdest(unfi, cr, cl):
-                        if ancestors and cl.rev() not in ancestors:
-                            continue
-                        r = remote.pushkey('bookmarks', k, nr, nl)
-                        if r:
-                            self.ui.status(_("updating bookmark %s\n") % k)
-                        else:
-                            self.ui.warn(_('updating bookmark %s'
-                                           ' failed!\n') % k)
-
+        bookmarks.updateremote(self.ui, unfi, remote, revs)
         return ret
 
     def changegroupinfo(self, nodes, source):
--- a/mercurial/lock.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/lock.py	Fri Dec 13 17:23:02 2013 -0600
@@ -29,7 +29,8 @@
 
     _host = None
 
-    def __init__(self, file, timeout=-1, releasefn=None, desc=None):
+    def __init__(self, vfs, file, timeout=-1, releasefn=None, desc=None):
+        self.vfs = vfs
         self.f = file
         self.held = 0
         self.timeout = timeout
@@ -75,13 +76,14 @@
         lockname = '%s:%s' % (lock._host, self.pid)
         while not self.held:
             try:
-                util.makelock(lockname, self.f)
+                self.vfs.makelock(lockname, self.f)
                 self.held = 1
             except (OSError, IOError), why:
                 if why.errno == errno.EEXIST:
                     locker = self.testlock()
                     if locker is not None:
-                        raise error.LockHeld(errno.EAGAIN, self.f, self.desc,
+                        raise error.LockHeld(errno.EAGAIN,
+                                             self.vfs.join(self.f), self.desc,
                                              locker)
                 else:
                     raise error.LockUnavailable(why.errno, why.strerror,
@@ -99,7 +101,7 @@
 
         """
         try:
-            locker = util.readlock(self.f)
+            locker = self.vfs.readlock(self.f)
         except (OSError, IOError), why:
             if why.errno == errno.ENOENT:
                 return None
@@ -119,8 +121,8 @@
         # if locker dead, break lock.  must do this with another lock
         # held, or can race and break valid lock.
         try:
-            l = lock(self.f + '.break', timeout=0)
-            util.unlink(self.f)
+            l = lock(self.vfs, self.f + '.break', timeout=0)
+            self.vfs.unlink(self.f)
             l.release()
         except error.LockError:
             return locker
@@ -140,7 +142,7 @@
             if self.releasefn:
                 self.releasefn()
             try:
-                util.unlink(self.f)
+                self.vfs.unlink(self.f)
             except OSError:
                 pass
             for callback in self.postrelease:
--- a/mercurial/manifest.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/manifest.py	Fri Dec 13 17:23:02 2013 -0600
@@ -30,8 +30,9 @@
 
 class manifest(revlog.revlog):
     def __init__(self, opener):
-        # we expect to deal with not more than three revs at a time in merge
-        self._mancache = util.lrucachedict(3)
+        # we expect to deal with not more than four revs at a time,
+        # during a commit --amend
+        self._mancache = util.lrucachedict(4)
         revlog.revlog.__init__(self, opener, "00manifest.i")
 
     def parse(self, lines):
--- a/mercurial/match.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/match.py	Fri Dec 13 17:23:02 2013 -0600
@@ -6,7 +6,7 @@
 # GNU General Public License version 2 or any later version.
 
 import re
-import scmutil, util, fileset
+import util, fileset, pathutil
 from i18n import _
 
 def _rematcher(pat):
@@ -317,7 +317,7 @@
     pats = []
     for kind, name in [_patsplit(p, default) for p in names]:
         if kind in ('glob', 'relpath'):
-            name = scmutil.canonpath(root, cwd, name, auditor)
+            name = pathutil.canonpath(root, cwd, name, auditor)
         elif kind in ('relglob', 'path'):
             name = util.normpath(name)
         elif kind in ('listfile', 'listfile0'):
--- a/mercurial/mdiff.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/mdiff.py	Fri Dec 13 17:23:02 2013 -0600
@@ -6,8 +6,8 @@
 # GNU General Public License version 2 or any later version.
 
 from i18n import _
-import bdiff, mpatch, util
-import re, struct, base85, zlib
+import bdiff, mpatch, util, base85
+import re, struct, zlib
 
 def splitnewlines(text):
     '''like str.splitlines, but only split on newlines.'''
--- a/mercurial/obsolete.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/obsolete.py	Fri Dec 13 17:23:02 2013 -0600
@@ -196,6 +196,14 @@
         self._data = data
         self._decodedmeta = None
 
+    def __hash__(self):
+        return hash(self._data)
+
+    def __eq__(self, other):
+        if type(other) != type(self):
+            return False
+        return self._data == other._data
+
     def precnode(self):
         """Precursor changeset node identifier"""
         return self._data[0]
@@ -268,7 +276,11 @@
         if not _enabled:
             raise util.Abort('obsolete feature is not enabled on this repo')
         known = set(self._all)
-        new = [m for m in markers if m not in known]
+        new = []
+        for m in markers:
+            if m not in known:
+                known.add(m)
+                new.append(m)
         if new:
             f = self.sopener('obsstore', 'ab')
             try:
--- a/mercurial/parsers.c	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/parsers.c	Fri Dec 13 17:23:02 2013 -0600
@@ -926,8 +926,13 @@
 static int nt_init(indexObject *self)
 {
 	if (self->nt == NULL) {
+		if (self->raw_length > INT_MAX) {
+			PyErr_SetString(PyExc_ValueError, "overflow in nt_init");
+			return -1;
+		}
 		self->ntcapacity = self->raw_length < 4
-			? 4 : self->raw_length / 2;
+			? 4 : (int)self->raw_length / 2;
+
 		self->nt = calloc(self->ntcapacity, sizeof(nodetree));
 		if (self->nt == NULL) {
 			PyErr_NoMemory();
--- a/mercurial/patch.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/patch.py	Fri Dec 13 17:23:02 2013 -0600
@@ -16,7 +16,6 @@
 from i18n import _
 from node import hex, short
 import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, error
-import context
 
 gitre = re.compile('diff --git a/(.*) b/(.*)')
 
@@ -722,8 +721,9 @@
             if self.remove:
                 self.backend.unlink(self.fname)
             else:
-                self.lines[:] = h.new()
-                self.offset += len(h.new())
+                l = h.new(self.lines)
+                self.lines[:] = l
+                self.offset += len(l)
                 self.dirty = True
             return 0
 
@@ -1017,9 +1017,10 @@
         return old, oldstart, new, newstart
 
 class binhunk(object):
-    'A binary patch file. Only understands literals so far.'
+    'A binary patch file.'
     def __init__(self, lr, fname):
         self.text = None
+        self.delta = False
         self.hunk = ['GIT binary patch\n']
         self._fname = fname
         self._read(lr)
@@ -1027,7 +1028,9 @@
     def complete(self):
         return self.text is not None
 
-    def new(self):
+    def new(self, lines):
+        if self.delta:
+            return [applybindelta(self.text, ''.join(lines))]
         return [self.text]
 
     def _read(self, lr):
@@ -1036,14 +1039,19 @@
             hunk.append(l)
             return l.rstrip('\r\n')
 
+        size = 0
         while True:
             line = getline(lr, self.hunk)
             if not line:
                 raise PatchError(_('could not extract "%s" binary data')
                                  % self._fname)
             if line.startswith('literal '):
+                size = int(line[8:].rstrip())
                 break
-        size = int(line[8:].rstrip())
+            if line.startswith('delta '):
+                size = int(line[6:].rstrip())
+                self.delta = True
+                break
         dec = []
         line = getline(lr, self.hunk)
         while len(line) > 1:
@@ -1266,6 +1274,62 @@
         gp = gitpatches.pop()
         yield 'file', ('a/' + gp.path, 'b/' + gp.path, None, gp.copy())
 
+def applybindelta(binchunk, data):
+    """Apply a binary delta hunk
+    The algorithm used is the algorithm from git's patch-delta.c
+    """
+    def deltahead(binchunk):
+        i = 0
+        for c in binchunk:
+            i += 1
+            if not (ord(c) & 0x80):
+                return i
+        return i
+    out = ""
+    s = deltahead(binchunk)
+    binchunk = binchunk[s:]
+    s = deltahead(binchunk)
+    binchunk = binchunk[s:]
+    i = 0
+    while i < len(binchunk):
+        cmd = ord(binchunk[i])
+        i += 1
+        if (cmd & 0x80):
+            offset = 0
+            size = 0
+            if (cmd & 0x01):
+                offset = ord(binchunk[i])
+                i += 1
+            if (cmd & 0x02):
+                offset |= ord(binchunk[i]) << 8
+                i += 1
+            if (cmd & 0x04):
+                offset |= ord(binchunk[i]) << 16
+                i += 1
+            if (cmd & 0x08):
+                offset |= ord(binchunk[i]) << 24
+                i += 1
+            if (cmd & 0x10):
+                size = ord(binchunk[i])
+                i += 1
+            if (cmd & 0x20):
+                size |= ord(binchunk[i]) << 8
+                i += 1
+            if (cmd & 0x40):
+                size |= ord(binchunk[i]) << 16
+                i += 1
+            if size == 0:
+                size = 0x10000
+            offset_end = offset + size
+            out += data[offset:offset_end]
+        elif cmd != 0:
+            offset_end = i + cmd
+            out += binchunk[i:offset_end]
+            i += cmd
+        else:
+            raise PatchError(_('unexpected delta opcode 0'))
+    return out
+
 def applydiff(ui, fp, backend, store, strip=1, eolmode='strict'):
     """Reads a patch from fp and tries to apply it.
 
@@ -1441,21 +1505,6 @@
     backend = repobackend(ui, repo, ctx, store)
     return patchbackend(ui, backend, patchobj, strip, files, eolmode)
 
-def makememctx(repo, parents, text, user, date, branch, files, store,
-               editor=None):
-    def getfilectx(repo, memctx, path):
-        data, (islink, isexec), copied = store.getfile(path)
-        return context.memfilectx(path, data, islink=islink, isexec=isexec,
-                                  copied=copied)
-    extra = {}
-    if branch:
-        extra['branch'] = encoding.fromlocal(branch)
-    ctx =  context.memctx(repo, parents, text, files, getfilectx, user,
-                          date, extra)
-    if editor:
-        ctx._text = editor(repo, ctx, [])
-    return ctx
-
 def patch(ui, repo, patchname, strip=1, files=None, eolmode='strict',
           similarity=0):
     """Apply <patchname> to the working directory.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/pathutil.py	Fri Dec 13 17:23:02 2013 -0600
@@ -0,0 +1,144 @@
+import os, errno, stat
+
+import util
+from i18n import _
+
+class pathauditor(object):
+    '''ensure that a filesystem path contains no banned components.
+    the following properties of a path are checked:
+
+    - ends with a directory separator
+    - under top-level .hg
+    - starts at the root of a windows drive
+    - contains ".."
+    - traverses a symlink (e.g. a/symlink_here/b)
+    - inside a nested repository (a callback can be used to approve
+      some nested repositories, e.g., subrepositories)
+    '''
+
+    def __init__(self, root, callback=None):
+        self.audited = set()
+        self.auditeddir = set()
+        self.root = root
+        self.callback = callback
+        if os.path.lexists(root) and not util.checkcase(root):
+            self.normcase = util.normcase
+        else:
+            self.normcase = lambda x: x
+
+    def __call__(self, path):
+        '''Check the relative path.
+        path may contain a pattern (e.g. foodir/**.txt)'''
+
+        path = util.localpath(path)
+        normpath = self.normcase(path)
+        if normpath in self.audited:
+            return
+        # AIX ignores "/" at end of path, others raise EISDIR.
+        if util.endswithsep(path):
+            raise util.Abort(_("path ends in directory separator: %s") % path)
+        parts = util.splitpath(path)
+        if (os.path.splitdrive(path)[0]
+            or parts[0].lower() in ('.hg', '.hg.', '')
+            or os.pardir in parts):
+            raise util.Abort(_("path contains illegal component: %s") % path)
+        if '.hg' in path.lower():
+            lparts = [p.lower() for p in parts]
+            for p in '.hg', '.hg.':
+                if p in lparts[1:]:
+                    pos = lparts.index(p)
+                    base = os.path.join(*parts[:pos])
+                    raise util.Abort(_("path '%s' is inside nested repo %r")
+                                     % (path, base))
+
+        normparts = util.splitpath(normpath)
+        assert len(parts) == len(normparts)
+
+        parts.pop()
+        normparts.pop()
+        prefixes = []
+        while parts:
+            prefix = os.sep.join(parts)
+            normprefix = os.sep.join(normparts)
+            if normprefix in self.auditeddir:
+                break
+            curpath = os.path.join(self.root, prefix)
+            try:
+                st = os.lstat(curpath)
+            except OSError, err:
+                # EINVAL can be raised as invalid path syntax under win32.
+                # They must be ignored for patterns can be checked too.
+                if err.errno not in (errno.ENOENT, errno.ENOTDIR, errno.EINVAL):
+                    raise
+            else:
+                if stat.S_ISLNK(st.st_mode):
+                    raise util.Abort(
+                        _('path %r traverses symbolic link %r')
+                        % (path, prefix))
+                elif (stat.S_ISDIR(st.st_mode) and
+                      os.path.isdir(os.path.join(curpath, '.hg'))):
+                    if not self.callback or not self.callback(curpath):
+                        raise util.Abort(_("path '%s' is inside nested "
+                                           "repo %r")
+                                         % (path, prefix))
+            prefixes.append(normprefix)
+            parts.pop()
+            normparts.pop()
+
+        self.audited.add(normpath)
+        # only add prefixes to the cache after checking everything: we don't
+        # want to add "foo/bar/baz" before checking if there's a "foo/.hg"
+        self.auditeddir.update(prefixes)
+
+    def check(self, path):
+        try:
+            self(path)
+            return True
+        except (OSError, util.Abort):
+            return False
+
+def canonpath(root, cwd, myname, auditor=None):
+    '''return the canonical path of myname, given cwd and root'''
+    if util.endswithsep(root):
+        rootsep = root
+    else:
+        rootsep = root + os.sep
+    name = myname
+    if not os.path.isabs(name):
+        name = os.path.join(root, cwd, name)
+    name = os.path.normpath(name)
+    if auditor is None:
+        auditor = pathauditor(root)
+    if name != rootsep and name.startswith(rootsep):
+        name = name[len(rootsep):]
+        auditor(name)
+        return util.pconvert(name)
+    elif name == root:
+        return ''
+    else:
+        # Determine whether `name' is in the hierarchy at or beneath `root',
+        # by iterating name=dirname(name) until that causes no change (can't
+        # check name == '/', because that doesn't work on windows). The list
+        # `rel' holds the reversed list of components making up the relative
+        # file name we want.
+        rel = []
+        while True:
+            try:
+                s = util.samefile(name, root)
+            except OSError:
+                s = False
+            if s:
+                if not rel:
+                    # name was actually the same as root (maybe a symlink)
+                    return ''
+                rel.reverse()
+                name = os.path.join(*rel)
+                auditor(name)
+                return util.pconvert(name)
+            dirname, basename = util.split(name)
+            rel.append(basename)
+            if dirname == name:
+                break
+            name = dirname
+
+        raise util.Abort(_("%s not under root '%s'") % (myname, root))
--- a/mercurial/repair.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/repair.py	Fri Dec 13 17:23:02 2013 -0600
@@ -38,16 +38,8 @@
     """return the changesets which will be broken by the truncation"""
     s = set()
     def collectone(revlog):
-        linkgen = (revlog.linkrev(i) for i in revlog)
-        # find the truncation point of the revlog
-        for lrev in linkgen:
-            if lrev >= striprev:
-                break
-        # see if any revision after this point has a linkrev
-        # less than striprev (those will be broken by strip)
-        for lrev in linkgen:
-            if lrev < striprev:
-                s.add(lrev)
+        _, brokenset = revlog.getstrippoint(striprev)
+        s.update([revlog.linkrev(r) for r in brokenset])
 
     collectone(repo.manifest)
     for fname in files:
--- a/mercurial/repoview.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/repoview.py	Fri Dec 13 17:23:02 2013 -0600
@@ -98,16 +98,6 @@
                'served': computeunserved,
                'immutable':  computemutable,
                'base':  computeimpactable}
-### Nearest subset relation
-# Nearest subset of filter X is a filter Y so that:
-# * Y is included in X,
-# * X - Y is as small as possible.
-# This create and ordering used for branchmap purpose.
-# the ordering may be partial
-subsettable = {None: 'visible',
-               'visible': 'served',
-               'served': 'immutable',
-               'immutable': 'base'}
 
 def filterrevs(repo, filtername):
     """returns set of filtered revision for this filter name"""
@@ -215,4 +205,3 @@
     @property
     def requirements(self):
         return self._unfilteredrepo.requirements
-
--- a/mercurial/revlog.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/revlog.py	Fri Dec 13 17:23:02 2013 -0600
@@ -401,7 +401,29 @@
         heads = [self.rev(n) for n in heads]
 
         # we want the ancestors, but inclusive
-        has = set(self.ancestors(common))
+        class lazyset(object):
+            def __init__(self, lazyvalues):
+                self.addedvalues = set()
+                self.lazyvalues = lazyvalues
+
+            def __contains__(self, value):
+                return value in self.addedvalues or value in self.lazyvalues
+
+            def __iter__(self):
+                added = self.addedvalues
+                for r in added:
+                    yield r
+                for r in self.lazyvalues:
+                    if not r in added:
+                        yield r
+
+            def add(self, value):
+                self.addedvalues.add(value)
+
+            def update(self, values):
+                self.addedvalues.update(values)
+
+        has = lazyset(self.ancestors(common))
         has.add(nullrev)
         has.update(common)
 
@@ -1263,6 +1285,46 @@
 
         return content
 
+    def getstrippoint(self, minlink):
+        """find the minimum rev that must be stripped to strip the linkrev
+
+        Returns a tuple containing the minimum rev and a set of all revs that
+        have linkrevs that will be broken by this strip.
+        """
+        brokenrevs = set()
+        strippoint = len(self)
+
+        heads = {}
+        futurelargelinkrevs = set()
+        for head in self.headrevs():
+            headlinkrev = self.linkrev(head)
+            heads[head] = headlinkrev
+            if headlinkrev >= minlink:
+                futurelargelinkrevs.add(headlinkrev)
+
+        # This algorithm involves walking down the rev graph, starting at the
+        # heads. Since the revs are topologically sorted according to linkrev,
+        # once all head linkrevs are below the minlink, we know there are
+        # no more revs that could have a linkrev greater than minlink.
+        # So we can stop walking.
+        while futurelargelinkrevs:
+            strippoint -= 1
+            linkrev = heads.pop(strippoint)
+
+            if linkrev < minlink:
+                brokenrevs.add(strippoint)
+            else:
+                futurelargelinkrevs.remove(linkrev)
+
+            for p in self.parentrevs(strippoint):
+                if p != nullrev:
+                    plinkrev = self.linkrev(p)
+                    heads[p] = plinkrev
+                    if plinkrev >= minlink:
+                        futurelargelinkrevs.add(plinkrev)
+
+        return strippoint, brokenrevs
+
     def strip(self, minlink, transaction):
         """truncate the revlog on the first revision with a linkrev >= minlink
 
@@ -1280,10 +1342,8 @@
         if len(self) == 0:
             return
 
-        for rev in self:
-            if self.index[rev][4] >= minlink:
-                break
-        else:
+        rev, _ = self.getstrippoint(minlink)
+        if rev == len(self):
             return
 
         # first truncate the files on disk
--- a/mercurial/scmutil.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/scmutil.py	Fri Dec 13 17:23:02 2013 -0600
@@ -8,8 +8,9 @@
 from i18n import _
 from mercurial.node import nullrev
 import util, error, osutil, revset, similar, encoding, phases, parsers
+import pathutil
 import match as matchmod
-import os, errno, re, stat, glob
+import os, errno, re, glob
 
 if os.name == 'nt':
     import scmwindows as scmplatform
@@ -97,9 +98,10 @@
         self._newfiles = set()
 
     def __call__(self, f):
+        if f in self._newfiles:
+            return
         fl = encoding.lower(f)
-        if (fl in self._loweredfiles and f not in self._dirstate and
-            f not in self._newfiles):
+        if fl in self._loweredfiles and f not in self._dirstate:
             msg = _('possible case-folding collision for %s') % f
             if self._abort:
                 raise util.Abort(msg)
@@ -107,100 +109,6 @@
         self._loweredfiles.add(fl)
         self._newfiles.add(f)
 
-class pathauditor(object):
-    '''ensure that a filesystem path contains no banned components.
-    the following properties of a path are checked:
-
-    - ends with a directory separator
-    - under top-level .hg
-    - starts at the root of a windows drive
-    - contains ".."
-    - traverses a symlink (e.g. a/symlink_here/b)
-    - inside a nested repository (a callback can be used to approve
-      some nested repositories, e.g., subrepositories)
-    '''
-
-    def __init__(self, root, callback=None):
-        self.audited = set()
-        self.auditeddir = set()
-        self.root = root
-        self.callback = callback
-        if os.path.lexists(root) and not util.checkcase(root):
-            self.normcase = util.normcase
-        else:
-            self.normcase = lambda x: x
-
-    def __call__(self, path):
-        '''Check the relative path.
-        path may contain a pattern (e.g. foodir/**.txt)'''
-
-        path = util.localpath(path)
-        normpath = self.normcase(path)
-        if normpath in self.audited:
-            return
-        # AIX ignores "/" at end of path, others raise EISDIR.
-        if util.endswithsep(path):
-            raise util.Abort(_("path ends in directory separator: %s") % path)
-        parts = util.splitpath(path)
-        if (os.path.splitdrive(path)[0]
-            or parts[0].lower() in ('.hg', '.hg.', '')
-            or os.pardir in parts):
-            raise util.Abort(_("path contains illegal component: %s") % path)
-        if '.hg' in path.lower():
-            lparts = [p.lower() for p in parts]
-            for p in '.hg', '.hg.':
-                if p in lparts[1:]:
-                    pos = lparts.index(p)
-                    base = os.path.join(*parts[:pos])
-                    raise util.Abort(_("path '%s' is inside nested repo %r")
-                                     % (path, base))
-
-        normparts = util.splitpath(normpath)
-        assert len(parts) == len(normparts)
-
-        parts.pop()
-        normparts.pop()
-        prefixes = []
-        while parts:
-            prefix = os.sep.join(parts)
-            normprefix = os.sep.join(normparts)
-            if normprefix in self.auditeddir:
-                break
-            curpath = os.path.join(self.root, prefix)
-            try:
-                st = os.lstat(curpath)
-            except OSError, err:
-                # EINVAL can be raised as invalid path syntax under win32.
-                # They must be ignored for patterns can be checked too.
-                if err.errno not in (errno.ENOENT, errno.ENOTDIR, errno.EINVAL):
-                    raise
-            else:
-                if stat.S_ISLNK(st.st_mode):
-                    raise util.Abort(
-                        _('path %r traverses symbolic link %r')
-                        % (path, prefix))
-                elif (stat.S_ISDIR(st.st_mode) and
-                      os.path.isdir(os.path.join(curpath, '.hg'))):
-                    if not self.callback or not self.callback(curpath):
-                        raise util.Abort(_("path '%s' is inside nested "
-                                           "repo %r")
-                                         % (path, prefix))
-            prefixes.append(normprefix)
-            parts.pop()
-            normparts.pop()
-
-        self.audited.add(normpath)
-        # only add prefixes to the cache after checking everything: we don't
-        # want to add "foo/bar/baz" before checking if there's a "foo/.hg"
-        self.auditeddir.update(prefixes)
-
-    def check(self, path):
-        try:
-            self(path)
-            return True
-        except (OSError, util.Abort):
-            return False
-
 class abstractvfs(object):
     """Abstract base class; cannot be instantiated"""
 
@@ -242,6 +150,9 @@
         finally:
             fp.close()
 
+    def chmod(self, path, mode):
+        return os.chmod(self.join(path), mode)
+
     def exists(self, path=None):
         return os.path.exists(self.join(path))
 
@@ -251,6 +162,9 @@
     def isdir(self, path=None):
         return os.path.isdir(self.join(path))
 
+    def isfile(self, path=None):
+        return os.path.isfile(self.join(path))
+
     def islink(self, path=None):
         return os.path.islink(self.join(path))
 
@@ -263,12 +177,18 @@
     def makedirs(self, path=None, mode=None):
         return util.makedirs(self.join(path), mode)
 
+    def makelock(self, info, path):
+        return util.makelock(info, self.join(path))
+
     def mkdir(self, path=None):
         return os.mkdir(self.join(path))
 
     def readdir(self, path=None, stat=None, skip=None):
         return osutil.listdir(self.join(path), stat, skip)
 
+    def readlock(self, path):
+        return util.readlock(self.join(path))
+
     def rename(self, src, dst):
         return util.rename(self.join(src), self.join(dst))
 
@@ -309,7 +229,7 @@
     def _setmustaudit(self, onoff):
         self._audit = onoff
         if onoff:
-            self.audit = pathauditor(self.base)
+            self.audit = pathutil.pathauditor(self.base)
         else:
             self.audit = util.always
 
@@ -444,52 +364,6 @@
         return self.vfs(path, mode, *args, **kw)
 
 
-def canonpath(root, cwd, myname, auditor=None):
-    '''return the canonical path of myname, given cwd and root'''
-    if util.endswithsep(root):
-        rootsep = root
-    else:
-        rootsep = root + os.sep
-    name = myname
-    if not os.path.isabs(name):
-        name = os.path.join(root, cwd, name)
-    name = os.path.normpath(name)
-    if auditor is None:
-        auditor = pathauditor(root)
-    if name != rootsep and name.startswith(rootsep):
-        name = name[len(rootsep):]
-        auditor(name)
-        return util.pconvert(name)
-    elif name == root:
-        return ''
-    else:
-        # Determine whether `name' is in the hierarchy at or beneath `root',
-        # by iterating name=dirname(name) until that causes no change (can't
-        # check name == '/', because that doesn't work on windows). The list
-        # `rel' holds the reversed list of components making up the relative
-        # file name we want.
-        rel = []
-        while True:
-            try:
-                s = util.samefile(name, root)
-            except OSError:
-                s = False
-            if s:
-                if not rel:
-                    # name was actually the same as root (maybe a symlink)
-                    return ''
-                rel.reverse()
-                name = os.path.join(*rel)
-                auditor(name)
-                return util.pconvert(name)
-            dirname, basename = util.split(name)
-            rel.append(basename)
-            if dirname == name:
-                break
-            name = dirname
-
-        raise util.Abort(_("%s not under root '%s'") % (myname, root))
-
 def walkrepos(path, followsym=False, seen_dirs=None, recurse=False):
     '''yield every hg repository under path, always recursively.
     The recurse flag will only control recursion into repo working dirs'''
@@ -767,7 +641,7 @@
     This is different from dirstate.status because it doesn't care about
     whether files are modified or clean.'''
     added, unknown, deleted, removed = [], [], [], []
-    audit_path = pathauditor(repo.root)
+    audit_path = pathutil.pathauditor(repo.root)
 
     ctx = repo[None]
     dirstate = repo.dirstate
@@ -851,14 +725,14 @@
               "Mercurial)") % "', '".join(missings))
     return requirements
 
-class filecacheentry(object):
-    def __init__(self, path, stat=True):
+class filecachesubentry(object):
+    def __init__(self, path, stat):
         self.path = path
         self.cachestat = None
         self._cacheable = None
 
         if stat:
-            self.cachestat = filecacheentry.stat(self.path)
+            self.cachestat = filecachesubentry.stat(self.path)
 
             if self.cachestat:
                 self._cacheable = self.cachestat.cacheable()
@@ -868,7 +742,7 @@
 
     def refresh(self):
         if self.cacheable():
-            self.cachestat = filecacheentry.stat(self.path)
+            self.cachestat = filecachesubentry.stat(self.path)
 
     def cacheable(self):
         if self._cacheable is not None:
@@ -882,7 +756,7 @@
         if not self.cacheable():
             return True
 
-        newstat = filecacheentry.stat(self.path)
+        newstat = filecachesubentry.stat(self.path)
 
         # we may not know if it's cacheable yet, check again now
         if newstat and self._cacheable is None:
@@ -906,24 +780,44 @@
             if e.errno != errno.ENOENT:
                 raise
 
+class filecacheentry(object):
+    def __init__(self, paths, stat=True):
+        self._entries = []
+        for path in paths:
+            self._entries.append(filecachesubentry(path, stat))
+
+    def changed(self):
+        '''true if any entry has changed'''
+        for entry in self._entries:
+            if entry.changed():
+                return True
+        return False
+
+    def refresh(self):
+        for entry in self._entries:
+            entry.refresh()
+
 class filecache(object):
-    '''A property like decorator that tracks a file under .hg/ for updates.
+    '''A property like decorator that tracks files under .hg/ for updates.
 
     Records stat info when called in _filecache.
 
-    On subsequent calls, compares old stat info with new info, and recreates
-    the object when needed, updating the new stat info in _filecache.
+    On subsequent calls, compares old stat info with new info, and recreates the
+    object when any of the files changes, updating the new stat info in
+    _filecache.
 
     Mercurial either atomic renames or appends for files under .hg,
     so to ensure the cache is reliable we need the filesystem to be able
     to tell us if a file has been replaced. If it can't, we fallback to
     recreating the object on every call (essentially the same behaviour as
-    propertycache).'''
-    def __init__(self, path):
-        self.path = path
+    propertycache).
+
+    '''
+    def __init__(self, *paths):
+        self.paths = paths
 
     def join(self, obj, fname):
-        """Used to compute the runtime path of the cached file.
+        """Used to compute the runtime path of a cached file.
 
         Users should subclass filecache and provide their own version of this
         function to call the appropriate join function on 'obj' (an instance
@@ -948,11 +842,11 @@
             if entry.changed():
                 entry.obj = self.func(obj)
         else:
-            path = self.join(obj, self.path)
+            paths = [self.join(obj, path) for path in self.paths]
 
             # We stat -before- creating the object so our cache doesn't lie if
             # a writer modified between the time we read and stat
-            entry = filecacheentry(path)
+            entry = filecacheentry(paths, True)
             entry.obj = self.func(obj)
 
             obj._filecache[self.name] = entry
@@ -964,7 +858,8 @@
         if self.name not in obj._filecache:
             # we add an entry for the missing value because X in __dict__
             # implies X in _filecache
-            ce = filecacheentry(self.join(obj, self.path), False)
+            paths = [self.join(obj, path) for path in self.paths]
+            ce = filecacheentry(paths, False)
             obj._filecache[self.name] = ce
         else:
             ce = obj._filecache[self.name]
--- a/mercurial/setdiscovery.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/setdiscovery.py	Fri Dec 13 17:23:02 2013 -0600
@@ -8,7 +8,8 @@
 
 from node import nullid
 from i18n import _
-import random, util, dagutil
+import random
+import util, dagutil
 
 def _updatesample(dag, nodes, sample, always, quicksamplesize=0):
     # if nodes is empty we scan the entire graph
--- a/mercurial/statichttprepo.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/statichttprepo.py	Fri Dec 13 17:23:02 2013 -0600
@@ -54,8 +54,10 @@
             data = data[:bytes]
         self.pos += len(data)
         return data
+    def readlines(self):
+        return self.read().splitlines(True)
     def __iter__(self):
-        return iter(self.read().splitlines(1))
+        return iter(self.readlines())
     def close(self):
         pass
 
--- a/mercurial/subrepo.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/subrepo.py	Fri Dec 13 17:23:02 2013 -0600
@@ -9,7 +9,8 @@
 import xml.dom.minidom
 import stat, subprocess, tarfile
 from i18n import _
-import config, scmutil, util, node, error, cmdutil, bookmarks, match as matchmod
+import config, util, node, error, cmdutil, bookmarks, match as matchmod
+import pathutil
 hg = None
 propertycache = util.propertycache
 
@@ -344,7 +345,7 @@
     import hg as h
     hg = h
 
-    scmutil.pathauditor(ctx._repo.root)(path)
+    pathutil.pathauditor(ctx._repo.root)(path)
     state = ctx.substate[path]
     if state[2] not in types:
         raise util.Abort(_('unknown subrepo type %s') % state[2])
--- a/mercurial/templatekw.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/templatekw.py	Fri Dec 13 17:23:02 2013 -0600
@@ -220,11 +220,10 @@
     return '%s: +%s/-%s' % (len(stats), adds, removes)
 
 def showextras(**args):
-    templ = args['templ']
-    for key, value in sorted(args['ctx'].extra().items()):
-        args = args.copy()
-        args.update(dict(key=key, value=value))
-        yield templ('extra', **args)
+    """:extras: List of dicts with key, value entries of the 'extras'
+    field of this changeset."""
+    yield showlist('extra', sorted(dict(key=a, value=b)
+                   for (a, b) in args['ctx'].extra().items()), **args)
 
 def showfileadds(**args):
     """:file_adds: List of strings. Files added by this changeset."""
@@ -392,6 +391,7 @@
     'parents': _showparents,
 }
 dockeywords.update(keywords)
+del dockeywords['branches']
 
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = dockeywords.values()
--- a/mercurial/transaction.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/transaction.py	Fri Dec 13 17:23:02 2013 -0600
@@ -12,8 +12,8 @@
 # GNU General Public License version 2 or any later version.
 
 from i18n import _
-import os, errno
-import error, util
+import errno
+import error
 
 def active(func):
     def _active(self, *args, **kwds):
@@ -35,14 +35,11 @@
                 raise
         else:
             try:
-                fp = opener(f)
-                fn = fp.name
-                fp.close()
-                util.unlink(fn)
+                opener.unlink(f)
             except (IOError, OSError), inst:
                 if inst.errno != errno.ENOENT:
                     raise
-    util.unlink(journal)
+    opener.unlink(journal)
 
 class transaction(object):
     def __init__(self, report, opener, journal, after=None, createmode=None):
@@ -56,9 +53,9 @@
         self.journal = journal
         self._queue = []
 
-        self.file = util.posixfile(self.journal, "w")
+        self.file = opener.open(self.journal, "w")
         if createmode is not None:
-            os.chmod(self.journal, createmode & 0666)
+            opener.chmod(self.journal, createmode & 0666)
 
     def __del__(self):
         if self.journal:
@@ -136,8 +133,8 @@
         self.entries = []
         if self.after:
             self.after()
-        if os.path.isfile(self.journal):
-            util.unlink(self.journal)
+        if self.opener.isfile(self.journal):
+            self.opener.unlink(self.journal)
         self.journal = None
 
     @active
@@ -155,7 +152,7 @@
         try:
             if not self.entries:
                 if self.journal:
-                    util.unlink(self.journal)
+                    self.opener.unlink(self.journal)
                 return
 
             self.report(_("transaction abort!\n"))
@@ -173,7 +170,7 @@
 def rollback(opener, file, report):
     entries = []
 
-    fp = util.posixfile(file)
+    fp = opener.open(file)
     lines = fp.readlines()
     fp.close()
     for l in lines:
--- a/mercurial/util.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/util.py	Fri Dec 13 17:23:02 2013 -0600
@@ -14,9 +14,9 @@
 """
 
 from i18n import _
-import error, osutil, encoding, collections
+import error, osutil, encoding
 import errno, re, shutil, sys, tempfile, traceback
-import os, time, datetime, calendar, textwrap, signal
+import os, time, datetime, calendar, textwrap, signal, collections
 import imp, socket, urllib
 
 if os.name == 'nt':
@@ -1033,9 +1033,10 @@
     if t < 0:
         t = 0   # time.gmtime(lt) fails on Windows for lt < -43200
         tz = 0
-    if "%1" in format or "%2" in format:
+    if "%1" in format or "%2" in format or "%z" in format:
         sign = (tz > 0) and "-" or "+"
         minutes = abs(tz) // 60
+        format = format.replace("%z", "%1%2")
         format = format.replace("%1", "%c%02d" % (sign, minutes // 60))
         format = format.replace("%2", "%02d" % (minutes % 60))
     try:
--- a/mercurial/worker.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/mercurial/worker.py	Fri Dec 13 17:23:02 2013 -0600
@@ -6,7 +6,8 @@
 # GNU General Public License version 2 or any later version.
 
 from i18n import _
-import errno, os, signal, sys, threading, util
+import errno, os, signal, sys, threading
+import util
 
 def countcpus():
     '''try to count the number of CPUs on the system'''
--- a/tests/bzr-definitions	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/bzr-definitions	Fri Dec 13 17:23:02 2013 -0600
@@ -5,11 +5,10 @@
 TERM=dumb; export TERM
 echo '[extensions]' >> $HGRCPATH
 echo 'convert = ' >> $HGRCPATH
-echo 'hgext.graphlog = ' >> $HGRCPATH
 
 glog()
 {
-    hg glog --template '{rev}@{branch} "{desc|firstline}" files: {files}\n' "$@"
+    hg log -G --template '{rev}@{branch} "{desc|firstline}" files: {files}\n' "$@"
 }
 
 manifest()
--- a/tests/hghave.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/hghave.py	Fri Dec 13 17:23:02 2013 -0600
@@ -233,6 +233,9 @@
     finally:
         os.rmdir(d)
 
+def has_root():
+    return getattr(os, 'geteuid', None) and os.geteuid() == 0
+
 def has_pyflakes():
     return matchoutput("sh -c \"echo 'import re' 2>&1 | pyflakes\"",
                        r"<stdin>:1: 're' imported but unused",
@@ -312,6 +315,7 @@
     "p4": (has_p4, "Perforce server and client"),
     "pyflakes": (has_pyflakes, "Pyflakes python linter"),
     "pygments": (has_pygments, "Pygments source highlighting library"),
+    "root": (has_root, "root permissions"),
     "serve": (has_serve, "platform and python can manage 'hg serve -d'"),
     "ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"),
     "svn": (has_svn, "subversion client and admin tools"),
--- a/tests/run-tests.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/run-tests.py	Fri Dec 13 17:23:02 2013 -0600
@@ -103,6 +103,7 @@
 
 requiredtools = [os.path.basename(sys.executable), "diff", "grep", "unzip",
                  "gunzip", "bunzip2", "sed"]
+createdfiles = []
 
 defaults = {
     'jobs': ('HGTEST_JOBS', 1),
@@ -420,6 +421,11 @@
     if not options.keep_tmpdir:
         vlog("# Cleaning up HGTMP", HGTMP)
         shutil.rmtree(HGTMP, True)
+        for f in createdfiles:
+            try:
+                os.remove(f)
+            except OSError:
+                pass
 
 def usecorrectpython():
     # some tests run python interpreter. they must use same
@@ -439,6 +445,7 @@
         if findprogram(pyexename) != sys.executable:
             try:
                 os.symlink(sys.executable, mypython)
+                createdfiles.append(mypython)
             except OSError, err:
                 # child processes may race, which is harmless
                 if err.errno != errno.EEXIST:
@@ -498,18 +505,6 @@
 
     usecorrectpython()
 
-    vlog("# Installing dummy diffstat")
-    f = open(os.path.join(BINDIR, 'diffstat'), 'w')
-    f.write('#!' + sys.executable + '\n'
-            'import sys\n'
-            'files = 0\n'
-            'for line in sys.stdin:\n'
-            '    if line.startswith("diff "):\n'
-            '        files += 1\n'
-            'sys.stdout.write("files patched: %d\\n" % files)\n')
-    f.close()
-    os.chmod(os.path.join(BINDIR, 'diffstat'), 0700)
-
     if options.py3k_warnings and not options.anycoverage:
         vlog("# Updating hg command to enable Py3k Warnings switch")
         f = open(os.path.join(BINDIR, 'hg'), 'r')
@@ -1139,6 +1134,8 @@
         _checkhglib("Tested")
         print "# Ran %d tests, %d skipped, %d failed." % (
             tested, skipped + ignored, failed)
+        if results['!']:
+            print 'python hash seed:', os.environ['PYTHONHASHSEED']
         if options.time:
             outputtimes(options)
 
@@ -1190,7 +1187,6 @@
         # use a random python hash seed all the time
         # we do the randomness ourself to know what seed is used
         os.environ['PYTHONHASHSEED'] = str(random.getrandbits(32))
-        print 'python hash seed:', os.environ['PYTHONHASHSEED']
 
     global TESTDIR, HGTMP, INST, BINDIR, PYTHONDIR, COVERAGE_FILE
     TESTDIR = os.environ["TESTDIR"] = os.getcwd()
--- a/tests/test-alias.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-alias.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,8 +1,5 @@
   $ HGFOO=BAR; export HGFOO
   $ cat >> $HGRCPATH <<EOF
-  > [extensions]
-  > graphlog=
-  > 
   > [alias]
   > # should clobber ci but not commit (issue2993)
   > ci = version
@@ -34,7 +31,7 @@
   > count = !hg log -r "\$@" --template=. | wc -c | sed -e 's/ //g'
   > mcount = !hg log \$@ --template=. | wc -c | sed -e 's/ //g'
   > rt = root
-  > tglog = glog --template "{rev}:{node|short}: '{desc}' {branches}\n"
+  > tglog = log -G --template "{rev}:{node|short}: '{desc}' {branches}\n"
   > idalias = id
   > idaliaslong = id
   > idaliasshell = !echo test
--- a/tests/test-blackbox.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-blackbox.t	Fri Dec 13 17:23:02 2013 -0600
@@ -65,7 +65,7 @@
   $ hg rollback
   repository tip rolled back to revision 1 (undo pull)
 
-#if unix-permissions
+#if unix-permissions no-root
   $ chmod 000 .hg/blackbox.log
   $ hg --debug incoming
   warning: cannot write to blackbox.log: Permission denied
@@ -98,7 +98,7 @@
   (run 'hg update' to get a working copy)
 
 a failure reading from the log is fine
-#if unix-permissions
+#if unix-permissions no-root
   $ hg blackbox -l 3
   abort: Permission denied: $TESTTMP/blackboxtest2/.hg/blackbox.log
   [255]
--- a/tests/test-bookmarks.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-bookmarks.t	Fri Dec 13 17:23:02 2013 -0600
@@ -549,7 +549,7 @@
 
 test stripping a non-checked-out but bookmarked revision
 
-  $ hg --config extensions.graphlog= log --graph
+  $ hg log --graph
   o  changeset:   4:9ba5f110a0b3
   |  branch:      test
   |  tag:         tip
@@ -587,7 +587,7 @@
   saved backup bundle to * (glob)
 should-end-on-two should end up pointing to revision 2, as that's the
 tipmost surviving ancestor of the stripped revision.
-  $ hg --config extensions.graphlog= log --graph
+  $ hg log --graph
   @  changeset:   3:9ba5f110a0b3
   |  branch:      test
   |  bookmark:    four
--- a/tests/test-bundle-vs-outgoing.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-bundle-vs-outgoing.t	Fri Dec 13 17:23:02 2013 -0600
@@ -75,12 +75,9 @@
   $ mkrev 8
   rev 8
 
-  $ echo "[extensions]" >> $HGRCPATH
-  $ echo "graphlog=" >> $HGRCPATH
-
 the story so far
 
-  $ hg glog --template "{rev}\n"
+  $ hg log -G --template "{rev}\n"
   @  8
   |
   | o  7
--- a/tests/test-clone.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-clone.t	Fri Dec 13 17:23:02 2013 -0600
@@ -543,7 +543,7 @@
   $ rm -rf b # work around bug with http clone
 
 
-#if unix-permissions
+#if unix-permissions no-root
 
 Inaccessible source
 
@@ -596,7 +596,7 @@
   [255]
 
 
-#if unix-permissions
+#if unix-permissions no-root
 
 leave existing directory in place after clone failure
 
--- a/tests/test-command-template.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-command-template.t	Fri Dec 13 17:23:02 2013 -0600
@@ -447,7 +447,7 @@
 
 Error if style not readable:
 
-#if unix-permissions
+#if unix-permissions no-root
   $ touch q
   $ chmod 0 q
   $ hg log --style ./q
@@ -479,7 +479,7 @@
 Error if include fails:
 
   $ echo 'changeset = q' >> t
-#if unix-permissions
+#if unix-permissions no-root
   $ hg log --style ./t
   abort: template file ./q: Permission denied
   [255]
@@ -1445,7 +1445,7 @@
   $ hg ci -m h2e -d '4 0'
 
   $ hg merge -q
-  $ hg ci -m merge -d '5 0'
+  $ hg ci -m merge -d '5 -3600'
 
 No tag set:
 
@@ -1533,7 +1533,7 @@
   > EOF
 
   $ hg -R latesttag tip
-  test 10:dee8f28249af
+  test 10:9b4a630e5f5f
 
 Test recursive showlist template (issue1989):
 
@@ -1587,6 +1587,21 @@
   b
   a
 
+Test date format:
+
+  $ hg log -R latesttag --template 'date: {date(date, "%y %m %d %S %z")}\n'
+  date: 70 01 01 10 +0000
+  date: 70 01 01 09 +0000
+  date: 70 01 01 08 +0000
+  date: 70 01 01 07 +0000
+  date: 70 01 01 06 +0000
+  date: 70 01 01 05 +0100
+  date: 70 01 01 04 +0000
+  date: 70 01 01 03 +0000
+  date: 70 01 01 02 +0000
+  date: 70 01 01 01 +0000
+  date: 70 01 01 00 +0000
+
 Test string escaping:
 
   $ hg log -R latesttag -r 0 --template '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
--- a/tests/test-commit-multiple.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-commit-multiple.t	Fri Dec 13 17:23:02 2013 -0600
@@ -4,7 +4,6 @@
   $ cat <<EOF >> $HGRCPATH
   > [extensions]
   > transplant =
-  > graphlog =
   > EOF
   $ hg init repo
   $ cd repo
@@ -39,7 +38,7 @@
   $ echo fix2 > bugfix
   $ echo fix2 >> file1
   $ hg ci -Am"fix 2"
-  $ hg glog --template="$template"
+  $ hg log -G --template="$template"
   @  3  fix 2  [fixes]
   |
   o  2  fix 1  [fixes]
@@ -59,7 +58,7 @@
   [0-9a-f]{12} transplanted to [0-9a-f]{12} (re)
   applying [0-9a-f]{12} (re)
   [0-9a-f]{12} transplanted to [0-9a-f]{12} (re)
-  $ hg glog --template="$template"
+  $ hg log -G --template="$template"
   @  5  fix 2  [release]
   |
   o  4  fix 1  [release]
--- a/tests/test-commit-unresolved.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-commit-unresolved.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,3 @@
-  $ echo "[extensions]" >> $HGRCPATH
-  $ echo "graphlog=" >> $HGRCPATH
-
   $ addcommit () {
   >     echo $1 > $1
   >     hg add $1
--- a/tests/test-completion.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-completion.t	Fri Dec 13 17:23:02 2013 -0600
@@ -305,7 +305,7 @@
 
   $ hg debugpathcomplete f
   fee
-  fie/
+  fie
   fo
   $ hg debugpathcomplete -f f
   fee
@@ -317,12 +317,6 @@
   $ hg debugpathcomplete -r F
   Fum
 
-If one directory and no files match, give an ambiguous answer
-
-  $ hg debugpathcomplete fi
-  fie/
-  fie/.
-
 Test debuglabelcomplete
 
   $ hg debuglabelcomplete
--- a/tests/test-convert-baz.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-baz.t	Fri Dec 13 17:23:02 2013 -0600
@@ -4,7 +4,6 @@
 
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "convert=" >> $HGRCPATH
-  $ echo 'graphlog =' >> $HGRCPATH
 
 create baz archive
   $ baz make-archive baz@mercurial--convert hg-test-convert-baz
@@ -129,7 +128,7 @@
 
   $ glog()
   > {
-  >     hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
+  >     hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
   > }
 
 show graph log
--- a/tests/test-convert-cvs-branch.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-cvs-branch.t	Fri Dec 13 17:23:02 2013 -0600
@@ -8,7 +8,6 @@
   > }
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "convert = " >> $HGRCPATH
-  $ echo "graphlog = " >> $HGRCPATH
   $ echo "[convert]" >> $HGRCPATH
   $ echo "cvsps.cache=0" >> $HGRCPATH
 
@@ -79,7 +78,7 @@
 
 Check the result
 
-  $ hg -R src-hg glog --template '{rev} ({branches}) {desc} files: {files}\n'
+  $ hg -R src-hg log -G --template '{rev} ({branches}) {desc} files: {files}\n'
   o  5 () update tags files: .hgtags
   |
   | o  4 (BRANCH) mod a again files: a
--- a/tests/test-convert-cvs-detectmerge.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-cvs-detectmerge.t	Fri Dec 13 17:23:02 2013 -0600
@@ -24,7 +24,6 @@
 
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "convert = " >> $HGRCPATH
-  $ echo "graphlog = " >> $HGRCPATH
   $ echo "[convert]" >> $HGRCPATH
   $ echo "cvsps.cache=0" >> $HGRCPATH
   $ echo "cvsps.mergefrom=\[MERGE from (\S+)\]" >> $HGRCPATH
@@ -210,7 +209,7 @@
 
 graphical log
 
-  $ hg -R proj.hg glog --template="$template"
+  $ hg -R proj.hg log -G --template="$template"
   o  9: '' fix file1 [MERGE from v1-1]
   |
   | o  8: 'v1_1' fix file1
--- a/tests/test-convert-cvs-synthetic.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-cvs-synthetic.t	Fri Dec 13 17:23:02 2013 -0600
@@ -3,7 +3,6 @@
   $ "$TESTDIR/hghave" cvs || exit 80
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "convert = " >> $HGRCPATH
-  $ echo "graphlog = " >> $HGRCPATH
 
 create cvs repository with one project
 
@@ -153,9 +152,9 @@
   1 MERGE from HEAD: add file6
   0 MERGE from v1_2: add file5
 
-hg glog output (#1)
+hg log -G output (#1)
 
-  $ hg -R proj.hg glog --template "{rev} {desc}\n"
+  $ hg -R proj.hg log -G --template "{rev} {desc}\n"
   o  8 MERGE from v1_2: add file5
   |
   | o  7 MERGE from HEAD: add file6
@@ -200,9 +199,9 @@
   1 MERGE from HEAD: add file6
   0 MERGE from v1_2: add file5
 
-hg glog output (#2)
+hg log -G output (#2)
 
-  $ hg -R proj.hg2 glog --template "{rev} {desc}\n"
+  $ hg -R proj.hg2 log -G --template "{rev} {desc}\n"
   o  8 MERGE from v1_2: add file5
   |
   | o  7 MERGE from HEAD: add file6
--- a/tests/test-convert-cvs.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-cvs.t	Fri Dec 13 17:23:02 2013 -0600
@@ -10,7 +10,6 @@
   > }
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "convert = " >> $HGRCPATH
-  $ echo "graphlog = " >> $HGRCPATH
   $ cat > cvshooks.py <<EOF
   > def cvslog(ui,repo,hooktype,log):
   >     print "%s hook: %d entries"%(hooktype,len(log))
@@ -307,7 +306,7 @@
   2 funny
   1 fuzzy
   0 fuzzy
-  $ hg -R src-hg glog --template '{rev} ({branches}) {desc} date: {date|date} files: {files}\n'
+  $ hg -R src-hg log -G --template '{rev} ({branches}) {desc} date: {date|date} files: {files}\n'
   o  8 (branch) fuzzy date: * -1000 files: b/c (glob)
   |
   o  7 (branch) fuzzy date: * -1000 files: a (glob)
--- a/tests/test-convert-cvsnt-mergepoints.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-cvsnt-mergepoints.t	Fri Dec 13 17:23:02 2013 -0600
@@ -22,7 +22,6 @@
   > }
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "convert = " >> $HGRCPATH
-  $ echo "graphlog = " >> $HGRCPATH
 
 create cvs repository
 
--- a/tests/test-convert-darcs.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-darcs.t	Fri Dec 13 17:23:02 2013 -0600
@@ -2,7 +2,6 @@
   $ "$TESTDIR/hghave" darcs || exit 80
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "convert=" >> $HGRCPATH
-  $ echo 'graphlog =' >> $HGRCPATH
   $ DARCS_EMAIL='test@example.org'; export DARCS_EMAIL
 
 initialize darcs repo
--- a/tests/test-convert-datesort.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-datesort.t	Fri Dec 13 17:23:02 2013 -0600
@@ -2,7 +2,6 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
   > convert=
-  > graphlog=
   > EOF
   $ hg init t
   $ cd t
@@ -83,7 +82,7 @@
 
 graph converted repo
 
-  $ hg -R t-datesort glog --template '{rev} "{desc}"\n'
+  $ hg -R t-datesort log -G --template '{rev} "{desc}"\n'
   o    12 "c1"
   |\
   | o  11 "b2x"
@@ -134,7 +133,7 @@
 
 graph converted repo
 
-  $ hg -R t-sourcesort glog --template '{rev} "{desc}"\n'
+  $ hg -R t-sourcesort log -G --template '{rev} "{desc}"\n'
   o    12 "c1"
   |\
   | o  11 "b2x"
@@ -185,7 +184,7 @@
 
 graph converted repo
 
-  $ hg -R t-closesort glog --template '{rev} "{desc}"\n'
+  $ hg -R t-closesort log -G --template '{rev} "{desc}"\n'
   o    12 "c1"
   |\
   | o  11 "c0"
--- a/tests/test-convert-filemap.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-filemap.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,11 +1,10 @@
 
   $ HGMERGE=true; export HGMERGE
   $ echo '[extensions]' >> $HGRCPATH
-  $ echo 'graphlog =' >> $HGRCPATH
   $ echo 'convert =' >> $HGRCPATH
   $ glog()
   > {
-  >     hg glog --template '{rev} "{desc}" files: {files}\n' "$@"
+  >     hg log -G --template '{rev} "{desc}" files: {files}\n' "$@"
   > }
   $ hg init source
   $ cd source
@@ -473,7 +472,7 @@
 
   $ glog()
   > {
-  >     hg glog --template '{rev}:{node|short}@{branch} "{desc}" files: {files}\n' "$@"
+  >     hg log -G --template '{rev}:{node|short}@{branch} "{desc}" files: {files}\n' "$@"
   > }
 
 test anonymous branch pruning
--- a/tests/test-convert-git.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-git.t	Fri Dec 13 17:23:02 2013 -0600
@@ -6,7 +6,6 @@
   $ echo "autocrlf = false" >> $HOME/.gitconfig
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "convert=" >> $HGRCPATH
-  $ echo 'hgext.graphlog =' >> $HGRCPATH
   $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
   $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
   $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
@@ -114,7 +113,7 @@
   $ cd ..
   $ glog()
   > {
-  >     hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
+  >     hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
   > }
   $ splitrepo()
   > {
--- a/tests/test-convert-hg-startrev.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-hg-startrev.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,7 +1,6 @@
 
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog =
   > convert =
   > [convert]
   > hg.saverev = yes
@@ -9,7 +8,7 @@
 
   $ glog()
   > {
-  >     hg -R "$1" glog --template '{rev} "{desc}" files: {files}\n'
+  >     hg -R "$1" log -G --template '{rev} "{desc}" files: {files}\n'
   > }
 
   $ hg init source
--- a/tests/test-convert-mtn.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-mtn.t	Fri Dec 13 17:23:02 2013 -0600
@@ -16,7 +16,6 @@
 
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "convert=" >> $HGRCPATH
-  $ echo 'graphlog =' >> $HGRCPATH
 
 Windows version of monotone home
 
@@ -257,7 +256,7 @@
   0 largefile
   $ glog()
   > {
-  >     hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
+  >     hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
   > }
   $ cd repo.mtn-hg
   $ hg up -C
--- a/tests/test-convert-splicemap.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-splicemap.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,10 +1,9 @@
 
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "convert=" >> $HGRCPATH
-  $ echo 'graphlog =' >> $HGRCPATH
   $ glog()
   > {
-  >     hg glog --template '{rev}:{node|short} "{desc|firstline}"\
+  >     hg log -G --template '{rev}:{node|short} "{desc|firstline}"\
   >  files: {files}\n' "$@"
   > }
   $ hg init repo1
--- a/tests/test-convert-svn-branches.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-svn-branches.t	Fri Dec 13 17:23:02 2013 -0600
@@ -4,7 +4,6 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
   > convert =
-  > graphlog =
   > EOF
 
   $ svnadmin create svn-repo
@@ -58,7 +57,7 @@
   0 branch trunk@1 into old3
 
   $ cd A-hg
-  $ hg glog --template 'branch={branches} {rev} {desc|firstline} files: {files}\n'
+  $ hg log -G --template 'branch={branches} {rev} {desc|firstline} files: {files}\n'
   o  branch=newbranch 11 branch trunk@1 into old3 files:
   |
   | o  branch= 10 last change to a files: a
--- a/tests/test-convert-svn-encoding.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-svn-encoding.t	Fri Dec 13 17:23:02 2013 -0600
@@ -4,7 +4,6 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
   > convert =
-  > graphlog =
   > EOF
 
   $ svnadmin create svn-repo
--- a/tests/test-convert-svn-move.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-svn-move.t	Fri Dec 13 17:23:02 2013 -0600
@@ -4,7 +4,6 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
   > convert =
-  > graphlog =
   > EOF
 
   $ svnadmin create svn-repo
@@ -39,7 +38,7 @@
   0 rename d4old into d4new
 
   $ cd A-hg
-  $ hg glog --template '{rev} {desc|firstline} files: {files}\n'
+  $ hg log -G --template '{rev} {desc|firstline} files: {files}\n'
   o  13 rename d4old into d4new files: d4new/g d4old/g
   |
   o  12 add d4old files: d4old/g
--- a/tests/test-convert-svn-sink.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-svn-sink.t	Fri Dec 13 17:23:02 2013 -0600
@@ -17,7 +17,6 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
   > convert =
-  > graphlog =
   > EOF
 
   $ hg init a
--- a/tests/test-convert-svn-source.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-svn-source.t	Fri Dec 13 17:23:02 2013 -0600
@@ -4,7 +4,6 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
   > convert =
-  > graphlog =
   > [convert]
   > svn.trunk = mytrunk
   > EOF
@@ -127,7 +126,7 @@
   updating tags
 
   $ cd B-hg
-  $ hg glog --template '{rev} {desc|firstline} date: {date|date} files: {files}\n'
+  $ hg log -G --template '{rev} {desc|firstline} date: {date|date} files: {files}\n'
   o  7 update tags date: * +0000 files: .hgtags (glob)
   |
   o  6 work in progress date: * -1000 files: letter2.txt (glob)
@@ -165,7 +164,7 @@
   0 work in progress
   $ hg -R fmap branch -q
   default
-  $ hg glog -R fmap --template '{rev} {desc|firstline} files: {files}\n'
+  $ hg log -G -R fmap --template '{rev} {desc|firstline} files: {files}\n'
   o  1 work in progress files: letter2.txt
   |
   o  0 second letter files: letter2.txt
--- a/tests/test-convert-svn-startrev.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-svn-startrev.t	Fri Dec 13 17:23:02 2013 -0600
@@ -4,7 +4,6 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
   > convert =
-  > graphlog =
   > EOF
   $ convert()
   > {
@@ -15,7 +14,7 @@
   >         --config convert.svn.branches="  " \
   >         --config convert.svn.tags= \
   >         --datesort svn-repo $repopath
-  >     hg -R $repopath glog \
+  >     hg -R $repopath log -G \
   >         --template '{rev} {desc|firstline} files: {files}\n'
   >     echo
   > }
--- a/tests/test-convert-svn-tags.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-svn-tags.t	Fri Dec 13 17:23:02 2013 -0600
@@ -4,7 +4,6 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
   > convert =
-  > graphlog =
   > EOF
 
   $ svnadmin create svn-repo
@@ -25,7 +24,7 @@
   updating tags
 
   $ cd A-hg
-  $ hg glog --template '{rev} {desc|firstline} tags: {tags}\n'
+  $ hg log -G --template '{rev} {desc|firstline} tags: {tags}\n'
   o  6 update tags tags: tip
   |
   o  5 changea tags: trunk.goodtag
--- a/tests/test-convert-tagsbranch-topology.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-tagsbranch-topology.t	Fri Dec 13 17:23:02 2013 -0600
@@ -6,7 +6,6 @@
   $ echo "autocrlf = false" >> $HOME/.gitconfig
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "convert=" >> $HGRCPATH
-  $ echo 'hgext.graphlog =' >> $HGRCPATH
   $ echo '[convert]' >> $HGRCPATH
   $ echo 'hg.usebranchnames = True' >> $HGRCPATH
   $ echo 'hg.tagsbranch = tags-update' >> $HGRCPATH
@@ -26,7 +25,7 @@
   > }
   $ glog()
   > {
-  >     hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
+  >     hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
   > }
   $ convertrepo()
   > {
--- a/tests/test-convert-tla.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert-tla.t	Fri Dec 13 17:23:02 2013 -0600
@@ -3,7 +3,6 @@
   $ tla my-id "mercurial <mercurial@selenic.com>"
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "convert=" >> $HGRCPATH
-  $ echo 'graphlog =' >> $HGRCPATH
 
 create tla archive
 
@@ -109,7 +108,7 @@
   $ tla register-archive -d tla@mercurial--convert
   $ glog()
   > {
-  >     hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
+  >     hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
   > }
 
 show graph log
--- a/tests/test-convert.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-convert.t	Fri Dec 13 17:23:02 2013 -0600
@@ -310,7 +310,7 @@
   abort: cannot create new bundle repository
   [255]
 
-#if unix-permissions
+#if unix-permissions no-root
 
 conversion to dir without permissions should fail
 
--- a/tests/test-debugbuilddag.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-debugbuilddag.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,5 +1,3 @@
-  $ echo "[extensions]" >> $HGRCPATH
-  $ echo "graphlog=" >> $HGRCPATH
 
 plain
 
@@ -60,7 +58,7 @@
   $ hg id
   000000000000
 glog
-  $ hg glog --template '{rev}: {desc} [{branches}] @ {date}\n'
+  $ hg log -G --template '{rev}: {desc} [{branches}] @ {date}\n'
   o  11: r11 [] @ 11.00
   |
   o  10: r10 [] @ 10.00
@@ -106,7 +104,7 @@
   $ hg id
   000000000000
 glog
-  $ hg glog --template '{rev}: {desc} [{branches}] @ {date}\n'
+  $ hg log -G --template '{rev}: {desc} [{branches}] @ {date}\n'
   o  11: r11 [] @ 11.00
   |
   o  10: r10 [] @ 10.00
@@ -132,7 +130,7 @@
   o  0: r0 [start] @ 0.00
   
 glog of
-  $ hg glog --template '{rev}: {desc} [{branches}]\n' of
+  $ hg log -G --template '{rev}: {desc} [{branches}]\n' of
   o  11: r11 []
   |
   o  10: r10 []
@@ -182,7 +180,7 @@
   $ hg id
   000000000000
 glog
-  $ hg glog --template '{rev}: {desc} [{branches}] @ {date}\n'
+  $ hg log -G --template '{rev}: {desc} [{branches}] @ {date}\n'
   o  11: r11 [] @ 11.00
   |
   o  10: r10 [] @ 10.00
@@ -208,7 +206,7 @@
   o  0: r0 [] @ 0.00
   
 glog mf
-  $ hg glog --template '{rev}: {desc} [{branches}]\n' mf
+  $ hg log -G --template '{rev}: {desc} [{branches}]\n' mf
   o  11: r11 []
   |
   o  10: r10 []
--- a/tests/test-doctest.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-doctest.py	Fri Dec 13 17:23:02 2013 -0600
@@ -1,49 +1,29 @@
 # this is hack to make sure no escape characters are inserted into the output
-import os
+import os, sys
 if 'TERM' in os.environ:
     del os.environ['TERM']
 import doctest
 
-import mercurial.util
-doctest.testmod(mercurial.util)
-# Only run doctests for the current platform
-doctest.testmod(mercurial.util.platform)
-
-import mercurial.changelog
-doctest.testmod(mercurial.changelog)
-
-import mercurial.dagparser
-doctest.testmod(mercurial.dagparser, optionflags=doctest.NORMALIZE_WHITESPACE)
-
-import mercurial.match
-doctest.testmod(mercurial.match)
-
-import mercurial.store
-doctest.testmod(mercurial.store)
-
-import mercurial.ui
-doctest.testmod(mercurial.ui)
+def testmod(name, optionflags=0, testtarget=None):
+    __import__(name)
+    mod = sys.modules[name]
+    if testtarget is not None:
+        mod = getattr(mod, testtarget)
+    doctest.testmod(mod, optionflags=optionflags)
 
-import mercurial.url
-doctest.testmod(mercurial.url)
-
-import mercurial.dispatch
-doctest.testmod(mercurial.dispatch)
-
-import mercurial.encoding
-doctest.testmod(mercurial.encoding)
-
-import mercurial.hgweb.hgwebdir_mod
-doctest.testmod(mercurial.hgweb.hgwebdir_mod)
-
-import hgext.convert.cvsps
-doctest.testmod(hgext.convert.cvsps)
-
-import mercurial.revset
-doctest.testmod(mercurial.revset)
-
-import mercurial.minirst
-doctest.testmod(mercurial.minirst)
-
-import mercurial.templatefilters
-doctest.testmod(mercurial.templatefilters)
+testmod('mercurial.changelog')
+testmod('mercurial.dagparser', optionflags=doctest.NORMALIZE_WHITESPACE)
+testmod('mercurial.dispatch')
+testmod('mercurial.encoding')
+testmod('mercurial.hgweb.hgwebdir_mod')
+testmod('mercurial.match')
+testmod('mercurial.minirst')
+testmod('mercurial.revset')
+testmod('mercurial.store')
+testmod('mercurial.templatefilters')
+testmod('mercurial.ui')
+testmod('mercurial.url')
+testmod('mercurial.util')
+testmod('mercurial.util', testtarget='platform')
+testmod('hgext.convert.cvsps')
+testmod('hgext.convert.filemap')
--- a/tests/test-filecache.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-filecache.py	Fri Dec 13 17:23:02 2013 -0600
@@ -18,9 +18,10 @@
     def sjoin(self, p):
         return p
 
-    @filecache('x')
+    @filecache('x', 'y')
     def cached(self):
         print 'creating'
+        return 'string from function'
 
     def invalidate(self):
         for k in self._filecache:
@@ -30,17 +31,20 @@
                 pass
 
 def basic(repo):
-    # file doesn't exist, calls function
+    print "* neither file exists"
+    # calls function
     repo.cached
 
     repo.invalidate()
-    # file still doesn't exist, uses cache
+    print "* neither file still exists"
+    # uses cache
     repo.cached
 
     # create empty file
     f = open('x', 'w')
     f.close()
     repo.invalidate()
+    print "* empty file x created"
     # should recreate the object
     repo.cached
 
@@ -48,11 +52,13 @@
     f.write('a')
     f.close()
     repo.invalidate()
+    print "* file x changed size"
     # should recreate the object
     repo.cached
 
     repo.invalidate()
-    # stats file again, nothing changed, reuses object
+    print "* nothing changed with either file"
+    # stats file again, reuses object
     repo.cached
 
     # atomic replace file, size doesn't change
@@ -63,6 +69,42 @@
     f.close()
 
     repo.invalidate()
+    print "* file x changed inode"
+    repo.cached
+
+    # create empty file y
+    f = open('y', 'w')
+    f.close()
+    repo.invalidate()
+    print "* empty file y created"
+    # should recreate the object
+    repo.cached
+
+    f = open('y', 'w')
+    f.write('A')
+    f.close()
+    repo.invalidate()
+    print "* file y changed size"
+    # should recreate the object
+    repo.cached
+
+    f = scmutil.opener('.')('y', 'w', atomictemp=True)
+    f.write('B')
+    f.close()
+
+    repo.invalidate()
+    print "* file y changed inode"
+    repo.cached
+
+    f = scmutil.opener('.')('x', 'w', atomictemp=True)
+    f.write('c')
+    f.close()
+    f = scmutil.opener('.')('y', 'w', atomictemp=True)
+    f.write('C')
+    f.close()
+
+    repo.invalidate()
+    print "* both files changed inode"
     repo.cached
 
 def fakeuncacheable():
@@ -76,10 +118,11 @@
     origcacheable = extensions.wrapfunction(util.cachestat, 'cacheable',
                                             wrapcacheable)
 
-    try:
-        os.remove('x')
-    except OSError:
-        pass
+    for fn in ['x', 'y']:
+        try:
+            os.remove(fn)
+        except OSError:
+            pass
 
     basic(fakerepo())
 
@@ -103,13 +146,28 @@
 
 def setbeforeget(repo):
     os.remove('x')
-    repo.cached = 0
+    os.remove('y')
+    repo.cached = 'string set externally'
     repo.invalidate()
+    print "* neither file exists"
     print repo.cached
     repo.invalidate()
     f = open('x', 'w')
     f.write('a')
     f.close()
+    print "* file x created"
+    print repo.cached
+
+    repo.cached = 'string 2 set externally'
+    repo.invalidate()
+    print "* string set externally again"
+    print repo.cached
+
+    repo.invalidate()
+    f = open('y', 'w')
+    f.write('b')
+    f.close()
+    print "* file y created"
     print repo.cached
 
 print 'basic:'
--- a/tests/test-filecache.py.out	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-filecache.py.out	Fri Dec 13 17:23:02 2013 -0600
@@ -1,17 +1,45 @@
 basic:
 
+* neither file exists
 creating
+* neither file still exists
+* empty file x created
+creating
+* file x changed size
 creating
+* nothing changed with either file
+* file x changed inode
 creating
+* empty file y created
+creating
+* file y changed size
+creating
+* file y changed inode
+creating
+* both files changed inode
 creating
 
 fakeuncacheable:
 
+* neither file exists
 creating
+* neither file still exists
 creating
+* empty file x created
+creating
+* file x changed size
+creating
+* nothing changed with either file
 creating
+* file x changed inode
 creating
+* empty file y created
 creating
+* file y changed size
+creating
+* file y changed inode
+creating
+* both files changed inode
 creating
 repository tip rolled back to revision -1 (undo commit)
 working directory now based on revision -1
@@ -20,6 +48,13 @@
 
 setbeforeget:
 
-0
+* neither file exists
+string set externally
+* file x created
 creating
-None
+string from function
+* string set externally again
+string 2 set externally
+* file y created
+creating
+string from function
--- a/tests/test-getbundle.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-getbundle.t	Fri Dec 13 17:23:02 2013 -0600
@@ -2,17 +2,12 @@
 
 = Test the getbundle() protocol function =
 
-Enable graphlog extension:
-
-  $ echo "[extensions]" >> $HGRCPATH
-  $ echo "graphlog=" >> $HGRCPATH
-
 Create a test repository:
 
   $ hg init repo
   $ cd repo
   $ hg debugbuilddag -n -m '+2 :fork +5 :p1 *fork +6 :p2 /p1 :m1 +3' > /dev/null
-  $ hg glog --template '{node}\n'
+  $ hg log -G --template '{node}\n'
   o  10c14a2cc935e1d8c31f9e98587dcf27fb08a6da
   |
   o  4801a72e5d88cb515b0c7e40fae34180f3f837f2
--- a/tests/test-glog.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-glog.t	Fri Dec 13 17:23:02 2013 -0600
@@ -102,7 +102,6 @@
   > EOF
 
   $ echo "[extensions]" >> $HGRCPATH
-  $ echo "graphlog=" >> $HGRCPATH
   $ echo "printrevset=`pwd`/printrevset.py" >> $HGRCPATH
 
   $ hg init repo
@@ -110,7 +109,7 @@
 
 Empty repo:
 
-  $ hg glog
+  $ hg log -G
 
 
 Building DAG:
@@ -152,7 +151,7 @@
   $ commit 34 "head" 32
 
 
-  $ hg glog -q
+  $ hg log -G -q
   @  34:fea3ac5810e0
   |
   | o  33:68608f5145f9
@@ -224,7 +223,7 @@
   o  0:e6eb3150255d
   
 
-  $ hg glog
+  $ hg log -G
   @  changeset:   34:fea3ac5810e0
   |  tag:         tip
   |  parent:      32:d06dffa21a31
@@ -461,7 +460,7 @@
   
 
 File glog:
-  $ hg glog a
+  $ hg log -G a
   @  changeset:   34:fea3ac5810e0
   |  tag:         tip
   |  parent:      32:d06dffa21a31
@@ -699,7 +698,7 @@
 
 File glog per revset:
 
-  $ hg glog -r 'file("a")'
+  $ hg log -G -r 'file("a")'
   @  changeset:   34:fea3ac5810e0
   |  tag:         tip
   |  parent:      32:d06dffa21a31
@@ -1131,14 +1130,14 @@
 
 
 Empty revision range - display nothing:
-  $ hg glog -r 1..0
+  $ hg log -G -r 1..0
 
   $ cd ..
 
 #if no-outer-repo
 
 From outer space:
-  $ hg glog -l1 repo
+  $ hg log -G -l1 repo
   @  changeset:   34:fea3ac5810e0
   |  tag:         tip
   |  parent:      32:d06dffa21a31
@@ -1146,7 +1145,7 @@
   |  date:        Thu Jan 01 00:00:34 1970 +0000
   |  summary:     (34) head
   |
-  $ hg glog -l1 repo/a
+  $ hg log -G -l1 repo/a
   @  changeset:   34:fea3ac5810e0
   |  tag:         tip
   |  parent:      32:d06dffa21a31
@@ -1154,7 +1153,7 @@
   |  date:        Thu Jan 01 00:00:34 1970 +0000
   |  summary:     (34) head
   |
-  $ hg glog -l1 repo/missing
+  $ hg log -G -l1 repo/missing
 
 #endif
 
@@ -1169,7 +1168,7 @@
   $ hg commit -mtwo
   $ echo more >two
   $ hg commit -mmore
-  $ hg glog two
+  $ hg log -G two
   @  changeset:   2:12c28321755b
   |  tag:         tip
   |  user:        test
@@ -1183,14 +1182,14 @@
   |
 
 Issue1896: File log with explicit style
-  $ hg glog --style=default one
+  $ hg log -G --style=default one
   o  changeset:   0:3d578b4a1f53
      user:        test
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     one
   
 Issue2395: glog --style header and footer
-  $ hg glog --style=xml one
+  $ hg log -G --style=xml one
   <?xml version="1.0"?>
   <log>
   o  <logentry revision="0" node="3d578b4a1f537d5fcf7301bfa9c0b97adfaa6fb1">
@@ -1276,7 +1275,7 @@
   $ cd repo
   $ touch b
   $ hg ci -Aqm0
-  $ hg glog -l2 a
+  $ hg log -G -l2 a
   o  changeset:   34:fea3ac5810e0
   |  parent:      32:d06dffa21a31
   |  user:        test
@@ -1291,7 +1290,7 @@
   | |
 
 File + limit + -ra:b, (b - a) < limit:
-  $ hg glog -l3000 -r32:tip a
+  $ hg log -G -l3000 -r32:tip a
   o  changeset:   34:fea3ac5810e0
   |  parent:      32:d06dffa21a31
   |  user:        test
@@ -1314,7 +1313,7 @@
 
 Point out a common and an uncommon unshown parent
 
-  $ hg glog -r 'rev(8) or rev(9)'
+  $ hg log -G -r 'rev(8) or rev(9)'
   o    changeset:   9:7010c0af0a35
   |\   parent:      7:b632bb1b1224
   | |  parent:      8:7a0b11f71937
@@ -1332,7 +1331,7 @@
 
 File + limit + -ra:b, b < tip:
 
-  $ hg glog -l1 -r32:34 a
+  $ hg log -G -l1 -r32:34 a
   o  changeset:   34:fea3ac5810e0
   |  parent:      32:d06dffa21a31
   |  user:        test
@@ -1342,7 +1341,7 @@
 
 file(File) + limit + -ra:b, b < tip:
 
-  $ hg glog -l1 -r32:34 -r 'file("a")'
+  $ hg log -G -l1 -r32:34 -r 'file("a")'
   o  changeset:   34:fea3ac5810e0
   |  parent:      32:d06dffa21a31
   |  user:        test
@@ -1352,7 +1351,7 @@
 
 limit(file(File) and a::b), b < tip:
 
-  $ hg glog -r 'limit(file("a") and 32::34, 1)'
+  $ hg log -G -r 'limit(file("a") and 32::34, 1)'
   o    changeset:   32:d06dffa21a31
   |\   parent:      27:886ed638191b
   | |  parent:      31:621d83e11f67
@@ -1363,11 +1362,11 @@
 
 File + limit + -ra:b, b < tip:
 
-  $ hg glog -r 'limit(file("a") and 34::32, 1)'
+  $ hg log -G -r 'limit(file("a") and 34::32, 1)'
 
 File + limit + -ra:b, b < tip, (b - a) < limit:
 
-  $ hg glog -l10 -r33:34 a
+  $ hg log -G -l10 -r33:34 a
   o  changeset:   34:fea3ac5810e0
   |  parent:      32:d06dffa21a31
   |  user:        test
@@ -1387,7 +1386,7 @@
   marked working directory as branch branch
   (branches are permanent and global, did you want a bookmark?)
   $ commit 36 "buggy merge: identical parents" 35 35
-  $ hg glog -l5
+  $ hg log -G -l5
   @  changeset:   36:08a19a744424
   |  branch:      branch
   |  tag:         tip
@@ -1561,7 +1560,7 @@
   $ hg ci -m "mv a b; add d"
   $ hg mv dir/b e
   $ hg ci -m "mv dir/b e"
-  $ hg glog --template '({rev}) {desc|firstline}\n'
+  $ hg log -G --template '({rev}) {desc|firstline}\n'
   @  (4) mv dir/b e
   |
   o  (3) mv a b; add d
@@ -2058,7 +2057,7 @@
   $ testlog --hidden
   []
   []
-  $ hg glog --template '{rev} {desc}\n'
+  $ hg log -G --template '{rev} {desc}\n'
   o  7 Added tag foo-bar for changeset fc281d8ff18d
   |
   o    6 merge 5 and 4
@@ -2078,7 +2077,7 @@
 
 A template without trailing newline should do something sane
 
-  $ hg glog -r ::2 --template '{rev} {desc}'
+  $ hg log -G -r ::2 --template '{rev} {desc}'
   o  2 mv b dir/b
   |
   o  1 copy a b
@@ -2088,7 +2087,7 @@
 
 Extra newlines must be preserved
 
-  $ hg glog -r ::2 --template '\n{rev} {desc}\n\n'
+  $ hg log -G -r ::2 --template '\n{rev} {desc}\n\n'
   o
   |  2 mv b dir/b
   |
@@ -2101,7 +2100,7 @@
 
 The almost-empty template should do something sane too ...
 
-  $ hg glog -r ::2 --template '\n'
+  $ hg log -G -r ::2 --template '\n'
   o
   |
   o
@@ -2111,12 +2110,12 @@
 
 issue3772
 
-  $ hg glog -r :null
+  $ hg log -G -r :null
   o  changeset:   -1:000000000000
      user:
      date:        Thu Jan 01 00:00:00 1970 +0000
   
-  $ hg glog -r null:null
+  $ hg log -G -r null:null
   o  changeset:   -1:000000000000
      user:
      date:        Thu Jan 01 00:00:00 1970 +0000
--- a/tests/test-graft.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-graft.t	Fri Dec 13 17:23:02 2013 -0600
@@ -25,7 +25,7 @@
   $ hg phase --public 3
   $ hg phase --force --secret 6
 
-  $ hg --config extensions.graphlog= log -G --template '{author}@{rev}.{phase}: {desc}\n'
+  $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
   @    test@6.secret: 6
   |\
   | o  test@5.draft: 5
@@ -249,7 +249,7 @@
 
 View graph:
 
-  $ hg --config extensions.graphlog= log -G --template '{author}@{rev}.{phase}: {desc}\n'
+  $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
   @  test@11.draft: 3
   |
   o  test@10.draft: 4
--- a/tests/test-histedit-bookmark-motion.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-histedit-bookmark-motion.t	Fri Dec 13 17:23:02 2013 -0600
@@ -2,7 +2,6 @@
 
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > histedit=
   > EOF
 
--- a/tests/test-histedit-commute.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-histedit-commute.t	Fri Dec 13 17:23:02 2013 -0600
@@ -2,7 +2,6 @@
 
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > histedit=
   > EOF
 
--- a/tests/test-histedit-drop.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-histedit-drop.t	Fri Dec 13 17:23:02 2013 -0600
@@ -2,7 +2,6 @@
 
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > histedit=
   > EOF
 
--- a/tests/test-histedit-edit.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-histedit-edit.t	Fri Dec 13 17:23:02 2013 -0600
@@ -2,7 +2,6 @@
 
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > histedit=
   > EOF
 
--- a/tests/test-histedit-fold-non-commute.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-histedit-fold-non-commute.t	Fri Dec 13 17:23:02 2013 -0600
@@ -2,7 +2,6 @@
 
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > histedit=
   > EOF
 
--- a/tests/test-histedit-fold.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-histedit-fold.t	Fri Dec 13 17:23:02 2013 -0600
@@ -14,7 +14,6 @@
   > [alias]
   > logt = log --template '{rev}:{node|short} {desc|firstline}\n'
   > [extensions]
-  > graphlog=
   > histedit=
   > EOF
 
--- a/tests/test-histedit-no-change.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-histedit-no-change.t	Fri Dec 13 17:23:02 2013 -0600
@@ -5,7 +5,6 @@
 
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > histedit=
   > EOF
 
@@ -64,7 +63,7 @@
   > {
   >     comment="${1:-log}"
   >     echo % "${comment}"
-  >     hg glog --template '{rev} {node} \"{desc|firstline}\"\n'
+  >     hg log -G --template '{rev} {node} \"{desc|firstline}\"\n'
   > }
 
 
--- a/tests/test-histedit-non-commute-abort.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-histedit-non-commute-abort.t	Fri Dec 13 17:23:02 2013 -0600
@@ -2,7 +2,6 @@
 
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > histedit=
   > EOF
 
--- a/tests/test-histedit-non-commute.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-histedit-non-commute.t	Fri Dec 13 17:23:02 2013 -0600
@@ -2,7 +2,6 @@
 
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > histedit=
   > EOF
 
--- a/tests/test-histedit-outgoing.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-histedit-outgoing.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > histedit=
   > EOF
 
--- a/tests/test-impexp-branch.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-impexp-branch.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,5 +1,5 @@
   $ echo '[extensions]' >> $HGRCPATH
-  $ echo 'mq =' >> $HGRCPATH
+  $ echo 'strip =' >> $HGRCPATH
 
   $ cat >findbranch.py <<EOF
   > import re, sys
--- a/tests/test-import-bypass.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-import-bypass.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,9 +1,8 @@
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "purge=" >> $HGRCPATH
-  $ echo "graphlog=" >> $HGRCPATH
 
   $ shortlog() {
-  >     hg glog --template '{rev}:{node|short} {author} {date|hgdate} - {branch} - {desc|firstline}\n'
+  >     hg log -G --template '{rev}:{node|short} {author} {date|hgdate} - {branch} - {desc|firstline}\n'
   > }
 
 Test --bypass with other options
--- a/tests/test-import-git.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-import-git.t	Fri Dec 13 17:23:02 2013 -0600
@@ -320,6 +320,118 @@
   045c85ba38952325e126c70962cc0f9d9077bc67 644   mbinary1
   a874b471193996e7cb034bb301cac7bdaf3e3f46 644   mbinary2
 
+Binary file and delta hunk (we build the patch using this sed hack to
+avoid an unquoted ^, which check-code says breaks sh on solaris):
+
+  $ sed 's/ caret /^/g;s/ dollarparen /$(/g' > quote-hack.patch <<'EOF'
+  > diff --git a/delta b/delta
+  > new file mode 100644
+  > index 0000000000000000000000000000000000000000..8c9b7831b231c2600843e303e66b521353a200b3
+  > GIT binary patch
+  > literal 3749
+  > zcmV;W4qEYvP)<h;3K|Lk000e1NJLTq006iE002D*0ssI2kt{U(0000PbVXQnQ*UN;
+  > zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU=M@d9MRCwC#oC!>o#}>x{(W-y~UN*tK
+  > z%A%sxiUy2Ys)0Vm#ueArYKoYqX;GuiqZpgirM6nCVoYk?YNAz3G~z;BZ~@~&OQEe4
+  > zmGvS5isFJI;Pd_7J+EKxyHZeu` caret t4r2>F;h-+VK3{_{WoGv8dSpFDYDrA%3UX03pt
+  > zOaVoi0*W#P6lDr1$`nwPDWE7*rhuYM0Y#YtiZTThWeO<D6i}2YpqR<%$s>bRRaI42
+  > zS3iFIxJ8Q=EnBv1Z7?pBw_bLjJb3V+tgP(Tty_2R-mR#p04x78n2n7MSOFyt4i1iv
+  > zjxH`PPEJmgD7U?IK&h;(EGQ@_DJc<@01=4fiNXHcKZ8LhZQ8T}E3U4tUS3}OrcgQW
+  > zWdX{K8#l7Ev&#$ysR)G#0*rC+<WGZ3?CtG4bm-ve>Dj$|_qJ`@D*stNP_AFUe&x!Q
+  > zJ9q9B7Z=ym)MyZ?Tg1ROunUYr81nV?B@!tYS~5_|%gfW#(_s<4UN1!Q?Dv8d>g#m6
+  > z%*@R2@bI2JdnzxQ!EDU`$eQY!tgI~Zn$prz;gaXNod5*5p(1Bz=P$qfvZ$y?dC@X~
+  > zlAD+NAKhB{=;6bMwzjqn>9mavvKOGd`s%A+fBiL>Q;xJWpa72C+}u{JTHUX>{~}Qj
+  > zUb%hyHgN~c?cBLjInvUALMD9g-aXt54ZL8AOCvXL-V6!~ijR*kEG$&Mv?!pE61OlI
+  > z8nzMSPE8F7bH|Py*RNl1VUCggq<V)>@_6gkEeiz7{rmTeuNTW6+KVS#0FG%IHf-3L
+  > zGiS21vn>WCCr+GLx caret !uNetzB6u3o(w6&1C2?_LW8ij$+$sZ*zZ`|US3H@8N~%&V%Z
+  > zAeA0HdhFS=$6|nzn3%YH`SN<>DQRO;Qc caret )dfdvA caret 5u`Xf;Zzu<ZQHgG?28V-#s<;T
+  > zzkh#LA)v7gpoE5ou3o*GoUUF%b#iht&kl9d0)><$FE1}ACr68;uCA`6DrGmz_U+rp
+  > zL>Rx;X_yhk$fP_yJrTCQ|NgsW0A<985g&c@k-NKly<>mgU8n||ZPPV<`SN8#%$+-T
+  > zfP$T!ou8jypFVwnzqhxyUvIxXd-wF~*U!ht=hCH1wzjqn9x#)IrhDa;S0JbK caret z_$W
+  > zd(8rX@;7|t*;GJ5h$SZ{v(}+UBEs$4w~?{@9%`_Z<P<kox5bMWuUWH(sF9hONgd$Q
+  > zunCgwT@1|CU9+;X caret 4z&|M~@yw23Ay50NFWn=FqF%yLZEUty;AT2??1oV@B)Nt))J7
+  > zh>{5j2@f7T=-an%L_`E)h;mZ4D_5>?7tjQtVPRo2XU-&;mX(!l-MSTJP4XWY82JAC
+  > z@57+y&!1=P{Mn{W8)-HzEsgAtd63}Cazc>O6vGb>51%@9DzbyI3?4j~$ijmT95_IS
+  > zS#r!LCDW%*4-O7CGnkr$xXR1RQ&UrA<CQt} caret 73NL%zk`)Jk!yxUAt-1r}ggLn-Zq}
+  > z*s){8pw68;i+kiG%CpBKYSJLLFyq&*U8}qDp+kpe&6<Vp(Z58%l#~>ZK?&s7y?b}i
+  > zuwcOgO%x-27A;y785zknl_{sU;E6v$8{pWmVS{KaJPpu`i;HP$#flY@u~Ua~K3%tN
+  > z-LhrNh{9SoHgDd%WXTc$$~Dq{?AWou3!H&?V8K{ caret {P9Ot5vecD?%1&-E-ntBFj87(
+  > zy5`QE%QRX7qcHC%1{Ua}M~}L6=`wQUNEQ=I;qc+ZMMXtK2T+0os;jEco;}OV9z1w3
+  > zARqv caret bm-85xnRCng3OT|MyVSmR3ND7 caret ?KaQGG! caret (aTbo1N;Nz;X3Q9FJbwK6`0?Yp
+  > zj*X2ac;Pw3!I2|JShDaF>-gJmzm1NLj){rk&o|$E caret WAsfrK=x&@B!`w7Hik81sPz4
+  > zuJTaiCppM>-+c!wPzcUw)5@?J4U-u|pJ~xbWUe-C+60k caret 7>9!)56DbjmA~`OJJ40v
+  > zu3hCA7eJXZWeN|1iJLu87$;+fS8+Kq6O`aT)*_x@sY#t7LxwoEcVw*)cWhhQW@l%!
+  > z{#Z=y+qcK@%z{p*D=8_Fcg278AnH3fI5;~yGu?9TscxXaaP*4$f<LIv! caret 5Lfr%vKg
+  > zpxmunH#%=+ICMvZA~wyNH%~eMl!-g caret R!cYJ#WmLq5N8viz#J%%LPtkO?V)tZ81cp>
+  > z{ALK?fNPePmd;289&M8Q3>YwgZX5GcGY&n>K1<x)!`;Qjg&}bb!Lrnl@xH#kS~VYE
+  > zpJmIJO`A3iy+Y3X`k>cY-@}Iw2Onq`=!ba3eATgs3yg3Wej=+P-Z8WF#w=RXvS@J3
+  > zEyhVTj-gO?kfDu1g9afo<RkPrYzG#_yF41IFxF%Ylg>9lx6<clPweR-b7Hn+r)e1l
+  > zO6c6FbNt@;;*w$z;N|H>h{czme)_4V6UC4hv**kX2@L caret Bgds dollarparen &P7M4dhfmWe)!=B
+  > zR3X=Y{P9N}p@-##@1ZNW1YbVaiP~D@8m&<dzEP&cO|87Ju#j*=;wH~Exr>i*Hpp&@
+  > z`9!Sj+O;byD~s8qZ>6QB8uv7Bpn&&?xe;;e<M4F8KEID&pT7QmqoSgq&06adp5T=U
+  > z6DH*4=AB7C1D9Amu?ia-wtxSAlmTEO96XHx)-+rKP;ip$pukuSJGW3P1aUmc2yo%)
+  > z&<t3F>d1X+1qzaag-%x+eKHx{?Afz3GBQSw9u0lw<mB+I#v11TKRpKWQS+lvVL7=u
+  > zHr6)1ynEF<i3kO6A8&ppPMo-F=PnWfXkSj@i*7J6C<F}wR?s(O0niC?t+6;+k}pPq
+  > zrok&TPU40rL0ZYDwenNrrmPZ`gjo@DEF`7 caret cKP||pUr;+r)hyn9O37=xA`3%Bj-ih
+  > z+1usk<%5G-y+R?tA`qY=)6&vNjL{P?QzHg%P%>`ZxP=QB%DHY6L26?36V_p caret {}n$q
+  > z3@9W=KmGI*Ng_Q#AzA%-z|Z caret |#oW(hkfgpuS$RKRhlrarX%efMMCs}GLChec5+y{6
+  > z1Qnxim_C-fmQuaAK_NUHUBV&;1c0V)wji<RcdZ*aAWTwyt>hVnlt caret asFCe0&a@tqp
+  > zEEy;$L}D$X6)wfQNl8gu6Z>oB3_RrP=gTyK2@@w#LbQfLNHj>Q&z(C5wUFhK+}0aV
+  > zSohlc=7K+spN<ctf}5KgKqNyJDNP9;LZd)nTE=9|6Xdr9%Hzk63-tL2c9FD*rsyYY
+  > z!}t+Yljq7-p$X;4_YL?6d;mdY3R##o1e%rlPxrsMh8|;sKTr~ caret QD#sw3&vS$FwlTk
+  > zp1#Gw!Qo-$LtvpXt#ApV0g) caret F=qFB`VB!W297x=$mr<$>rco3v$QKih_xN!k6;M=@
+  > zCr?gDNQj7tm@;JwD;Ty&NlBSCYZk(b3dZeN8D4h2{r20dSFc7;(>E&r`s=TVtzpB4
+  > zk+ caret N&zCAiRns(?p6iBlk9v&h{1ve(FNtc)td51M>)TkXhc6{>5C)`fS$&)A1*CP1%
+  > zld+peue4aYbg3C0!+4mu+}vE caret j_feX+ZijvffBI7Ofh#RZ*U3<3J5(+nfRCzexqQ5
+  > zgM&##Y4Dd{e%ZKjqrbm@|Ni}l4jo!AqtFynj3Xsd$o caret ?yV4$|UQ(j&UWCH>M=o_&N
+  > zmclXc3i|Q#<;#EoG>~V}4unTHbUK}u=y4;rA3S&vzC3 caret aJP!&D4RvvGfoyo(>C>la
+  > zijP<=v>X{3Ne&2BXo}DV8l0V-jdv`$am0ubG{Wuh%CTd|l9Q7m;G&|U@#Dvbhlj(d
+  > zg6W{3ATxYt#T?)3;SmIgOP4M|Dki~I_TX7SxP0x}wI~DQI7Lhm2BI7gph(aPIFAd;
+  > zQ&UsF`Q{rOz+z=87c5v%@5u~d6dWV5OlX`oH3cAH&UlvsZUEo(Q(P|lKs17rXvaiU
+  > zQcj}IEufi1+Bnh6&(EhF{7O3vLHp`jjlp0J<M1kh$+$2xGm~Zk7OY7(q=&Rdhq*RG
+  > zwrmcd5MnP}xByB_)P@{J>DR9x6;`cUwPM8z){yooNiXPOc9_{W-gtwxE5TUg0vJk6
+  > zO#JGruV&1cL6VGK2?+_YQr4`+EY8;Sm$9U$uuGRN=uj3k7?O9b+R~J7t_y*K64ZnI
+  > zM+{aE<b(v?vSmw;9zFP!aE266zHIhlmdI@ caret xa6o2jwdRk54a$>pcRbC29ZyG!Cfdp
+  > zutFf`Q`vljgo!(wHf=)F#m2_MIuj;L(2ja2YsQRX+rswV{d<H`Ar;(@%aNa9VPU8Z
+  > z;tq*`y}dm#NDJHKlV}uTIm!_vAq5E7!X-p{P=Z=Sh668>PuVS1*6e}OwOiMc;u3OQ
+  > z@Bs)w3=lzfKoufH$SFuPG@uZ4NOnM#+=8LnQ2Q4zUd+nM+OT26;lqbN{P07dhH{jH
+  > zManE8 caret dLms-Q2;1kB<*Q1a3f8kZr;xX=!Qro@`~@xN*Qj>gx;i;0Z24!~i2uLb`}v
+  > zA?R$|wvC+m caret Ups=*(4lDh*=UN8{5h(A?p#D caret 2N$8u4Z55!q?ZAh(iEEng9_Zi>IgO
+  > z#~**JC8hE4@n{hO&8btT5F*?nC_%LhA3i)PDhh-pB_&1wGrDIl caret *=8x3n&;akBf caret -
+  > zJd&86kq$%%907v caret tgWoQdwI`|oNK%VvU~S#C<o caret F?6c48?Cjj#-4P<>HFD%&|Ni~t
+  > zKJ(|#H`$<5W+6ZkBb213rXonKZLB+X> caret L}J@W6osP3piLD_5?R!`S}*{xLBzFiL4@
+  > zX+}l{`A%?f@T5tT%ztu60p;)be`fWC`tP@WpO=?cpf8Xuf1OSj6d3f@Ki(ovDYq%0
+  > z{4ZSe`kOay5@=lAT!}vFzxyemC{sXDrhuYM0Y#ZI1r%ipD9W11{w=@&xgJ}t2x;ep
+  > P00000NkvXXu0mjfZ5|Er
+  > 
+  > literal 0
+  > HcmV?d00001
+  > 
+  > EOF
+  $ hg import -d "1000000 0" -m delta quote-hack.patch
+  applying quote-hack.patch
+  $ rm quote-hack.patch
+
+  $ hg manifest --debug | grep delta
+  9600f98bb60ce732634d126aaa4ac1ec959c573e 644   delta
+
+  $ hg import -d "1000000 0" -m delta - <<'EOF'
+  > diff --git a/delta b/delta
+  > index 8c9b7831b231c2600843e303e66b521353a200b3..0021dd95bc0dba53c39ce81377126d43731d68df 100644
+  > GIT binary patch
+  > delta 49
+  > zcmZ1~yHs|=21Z8J$r~9bFdA-lVv=EEw4WT$qRf2QSa5SIOAHI6(&k4T8H|kLo4vWB
+  > FSO9ZT4bA`n
+  > 
+  > delta 49
+  > zcmV-10M7rV9i<(xumJ(}ld%Di0Xefm0vrMXpOaq%BLm9I%d>?9Tm%6Vv*HM70RcC&
+  > HOA1;9yU-AD
+  > 
+  > EOF
+  applying patch from stdin
+
+  $ hg manifest --debug | grep delta
+  56094bbea136dcf8dbd4088f6af469bde1a98b75 644   delta
+
 Filenames with spaces:
 
   $ sed 's,EOL$,,g' <<EOF | hg import -d "1000000 0" -m spaces -
@@ -334,7 +446,7 @@
   applying patch from stdin
 
   $ hg tip -q
-  12:47500ce1614e
+  14:4b79479c9a6d
 
   $ cat "foo bar"
   foo
@@ -357,7 +469,7 @@
   applying patch from stdin
 
   $ hg tip -q
-  13:6757efb07ea9
+  15:9cbe44af4ae9
 
   $ cat foo3
   foo
@@ -392,8 +504,8 @@
 Invalid base85 content
 
   $ hg rollback
-  repository tip rolled back to revision 14 (undo import)
-  working directory now based on revision 14
+  repository tip rolled back to revision 16 (undo import)
+  working directory now based on revision 16
   $ hg revert -aq
   $ hg import -d "1000000 0" -m invalid-binary - <<"EOF"
   > diff --git a/text2 b/binary2
--- a/tests/test-journal-exists.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-journal-exists.t	Fri Dec 13 17:23:02 2013 -0600
@@ -22,7 +22,7 @@
 
 Check that zero-size journals are correctly aborted:
 
-#if unix-permissions
+#if unix-permissions no-root
   $ hg bundle -qa repo.hg
   $ chmod -w foo/.hg/store/00changelog.i
 
--- a/tests/test-largefiles.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-largefiles.t	Fri Dec 13 17:23:02 2013 -0600
@@ -2256,7 +2256,7 @@
   > largefiles=
   > EOF
   $ hg -R enabledlocally root
-  $TESTTMP/individualenabling/enabledlocally
+  $TESTTMP/individualenabling/enabledlocally (glob)
   $ hg -R notenabledlocally root
   abort: unknown repository format: requires features 'largefiles' (upgrade Mercurial)!
   [255]
--- a/tests/test-lfconvert.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-lfconvert.t	Fri Dec 13 17:23:02 2013 -0600
@@ -4,8 +4,7 @@
   > [extensions]
   > largefiles =
   > share =
-  > graphlog =
-  > mq =
+  > strip =
   > convert =
   > [largefiles]
   > minsize = 0.5
@@ -134,7 +133,7 @@
   $ hg cat -r . sub/maybelarge.dat > stuff/maybelarge.dat
   $ hg resolve -m stuff/maybelarge.dat
   $ hg commit -m"merge"
-  $ hg glog --template "{rev}:{node|short}  {desc|firstline}\n"
+  $ hg log -G --template "{rev}:{node|short}  {desc|firstline}\n"
   @    5:4884f215abda  merge
   |\
   | o  4:7285f817b77e  remove large, normal3
@@ -154,7 +153,7 @@
   $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo
   initializing destination largefiles-repo
   $ cd largefiles-repo
-  $ hg glog --template "{rev}:{node|short}  {desc|firstline}\n"
+  $ hg log -G --template "{rev}:{node|short}  {desc|firstline}\n"
   o    5:8e05f5f2b77e  merge
   |\
   | o  4:a5a02de7a8e4  remove large, normal3
@@ -248,7 +247,7 @@
 # "hg remove" + "hg merge" + "hg commit".
 #  $ hg -R ../bigfile-repo debugdata -c 5
 #  $ hg debugdata -c 5
-  $ hg glog --template "{rev}:{node|short}  {desc|firstline}\n"
+  $ hg log -G --template "{rev}:{node|short}  {desc|firstline}\n"
   o  6:1635824e6f59  add anotherlarge (should be a largefile)
   |
   o    5:7215f8deeaaf  merge
@@ -292,7 +291,7 @@
   1 merge
   0 add anotherlarge (should be a largefile)
 
-  $ hg -R largefiles-repo-hg glog --template "{rev}:{node|short}  {desc|firstline}\n"
+  $ hg -R largefiles-repo-hg log -G --template "{rev}:{node|short}  {desc|firstline}\n"
   o  6:17126745edfd  add anotherlarge (should be a largefile)
   |
   o    5:9cc5aa7204f0  merge
--- a/tests/test-lock-badness.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-lock-badness.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,5 +1,4 @@
-  $ "$TESTDIR/hghave" unix-permissions || exit 80
-
+#if unix-permissions no-root
   $ hg init a
   $ echo a > a/a
   $ hg -R a ci -A -m a
@@ -21,4 +20,4 @@
   [255]
 
   $ chmod 700 a/.hg/store
-
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-module-imports.t	Fri Dec 13 17:23:02 2013 -0600
@@ -0,0 +1,39 @@
+This code uses the ast module, which was new in 2.6, so we'll skip
+this test on anything earlier.
+  $ python -c 'import sys ; assert sys.version_info >= (2, 6)' || exit 80
+
+  $ import_checker="$TESTDIR"/../contrib/import-checker.py
+Run the doctests from the import checker, and make sure
+it's working correctly.
+  $ TERM=dumb
+  $ export TERM
+  $ python -m doctest $import_checker
+
+  $ cd "$TESTDIR"/..
+  $ if hg identify -q > /dev/null 2>&1; then :
+  > else
+  >     echo "skipped: not a Mercurial working dir" >&2
+  >     exit 80
+  > fi
+
+There are a handful of cases here that require renaming a module so it
+doesn't overlap with a stdlib module name. There are also some cycles
+here that we should still endeavor to fix, and some cycles will be
+hidden by deduplication algorithm in the cycle detector, so fixing
+these may expose other cycles.
+
+  $ hg locate 'mercurial/**.py' | xargs python "$import_checker"
+  mercurial/dispatch.py mixed stdlib and relative imports:
+     commands, error, extensions, fancyopts, hg, hook, util
+  mercurial/fileset.py mixed stdlib and relative imports:
+     error, merge, parser, util
+  mercurial/revset.py mixed stdlib and relative imports:
+     discovery, error, hbisect, parser, phases, util
+  mercurial/templater.py mixed stdlib and relative imports:
+     config, error, parser, templatefilters, util
+  mercurial/ui.py mixed stdlib and relative imports:
+     config, error, formatter, scmutil, util
+  Import cycle: mercurial.cmdutil -> mercurial.subrepo -> mercurial.cmdutil
+  Import cycle: mercurial.repoview -> mercurial.revset -> mercurial.repoview
+  Import cycle: mercurial.fileset -> mercurial.merge -> mercurial.subrepo -> mercurial.match -> mercurial.fileset
+  Import cycle: mercurial.filemerge -> mercurial.match -> mercurial.fileset -> mercurial.merge -> mercurial.filemerge
--- a/tests/test-mq-qpush-exact.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-mq-qpush-exact.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "mq=" >> $HGRCPATH
-  $ echo "graphlog=" >> $HGRCPATH
 
 make a test repository that looks like this:
 
--- a/tests/test-mq-safety.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-mq-safety.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ echo '[extensions]' >> $HGRCPATH
   $ echo 'hgext.mq =' >> $HGRCPATH
-  $ echo 'hgext.graphlog =' >> $HGRCPATH
 
   $ hg init repo
   $ cd repo
--- a/tests/test-obsolete-checkheads.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-obsolete-checkheads.t	Fri Dec 13 17:23:02 2013 -0600
@@ -10,9 +10,8 @@
   > [ui]
   > logtemplate='{node|short} ({phase}) {desc|firstline}\n'
   > [extensions]
-  > graphlog=
+  > obs=${TESTTMP}/obs.py
   > EOF
-  $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
   $ mkcommit() {
   >    echo "$1" > "$1"
   >    hg add "$1"
@@ -52,7 +51,7 @@
   $ mkcommit new
   created new head
   $ hg debugobsolete --flags 1 `getid old` `getid new`
-  $ hg glog --hidden
+  $ hg log -G --hidden
   @  71e3228bffe1 (draft) add new
   |
   | x  c70b08862e08 (draft) add old
@@ -84,7 +83,7 @@
   pulling from $TESTTMP/remote (glob)
   searching for changes
   no changes found
-  $ hg glog --hidden
+  $ hg log -G --hidden
   @  71e3228bffe1 (draft) add new
   |
   | o  c70b08862e08 (public) add old
@@ -112,7 +111,7 @@
 #   $ cp -r ../backup1 ../remote
 #   $ hg -R ../remote phase --public c70b08862e08
 #   $ hg phase --draft --force c70b08862e08
-#   $ hg glog --hidden
+#   $ hg log -G --hidden
 #   @  71e3228bffe1 (draft) add new
 #   |
 #   | x  c70b08862e08 (draft) add old
@@ -141,7 +140,7 @@
   $ hg up -q '.^'
   $ mkcommit other
   created new head
-  $ hg glog --hidden
+  $ hg log -G --hidden
   @  d7d41ccbd4de (draft) add other
   |
   | o  71e3228bffe1 (draft) add new
@@ -193,7 +192,7 @@
   $ mkcommit desc2
   created new head
   $ hg debugobsolete `getid old` `getid new`
-  $ hg glog --hidden
+  $ hg log -G --hidden
   @  5fe37041cc2b (draft) add desc2
   |
   | o  a3ef1d111c5f (draft) add desc1
@@ -204,7 +203,7 @@
   |/
   o  b4952fcf48cf (public) add base
   
-  $ hg glog --hidden -R ../remote
+  $ hg log -G --hidden -R ../remote
   o  71e3228bffe1 (draft) add new
   |
   | o  c70b08862e08 (draft) add old
@@ -248,12 +247,12 @@
   $ hg  id --debug -r tip
   71e3228bffe1886550777233d6c97bb5a6b2a650 tip
   $ hg debugobsolete c70b08862e0838ea6d7c59c85da2f1ed6c8d67da 71e3228bffe1886550777233d6c97bb5a6b2a650
-  $ hg glog --hidden
+  $ hg log -G --hidden
   @  71e3228bffe1 (draft) add new
   |
   o  b4952fcf48cf (public) add base
   
-  $ hg glog --hidden -R ../remote
+  $ hg log -G --hidden -R ../remote
   o  c70b08862e08 (draft) add old
   |
   @  b4952fcf48cf (public) add base
@@ -261,9 +260,6 @@
 
 Push should not complain about new heads.
 
-It should not complain about "unsynced remote changes!" either but that's not
-handled yet.
-
   $ hg push --traceback
   pushing to $TESTTMP/remote (glob)
   searching for changes
--- a/tests/test-obsolete.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-obsolete.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,4 @@
   $ cat >> $HGRCPATH << EOF
-  > [extensions]
-  > graphlog=
   > [phases]
   > # public changeset are not obsolete
   > publish=false
@@ -120,7 +118,7 @@
 
 Check that graphlog detect that a changeset is obsolete:
 
-  $ hg glog
+  $ hg log -G
   @  changeset:   5:5601fb93a350
   |  tag:         tip
   |  parent:      1:7c3bad9141dc
@@ -217,7 +215,7 @@
 Check that public changeset are not accounted as obsolete:
 
   $ hg --hidden phase --public 2
-  $ hg --config 'extensions.graphlog=' glog
+  $ hg log -G
   @  changeset:   5:5601fb93a350
   |  tag:         tip
   |  parent:      1:7c3bad9141dc
@@ -514,7 +512,7 @@
 ---------------------------------------
 
 
-  $ hg glog
+  $ hg log -G
   o  changeset:   3:6f9641995072
   |  tag:         tip
   |  parent:      1:7c3bad9141dc
@@ -548,7 +546,7 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     add original_d
   
-  $ hg glog -r '::unstable()'
+  $ hg log -G -r '::unstable()'
   @  changeset:   5:cda648ca50f5
   |  tag:         tip
   |  user:        test
@@ -653,7 +651,7 @@
 
 Do not warn about new head when the new head is a successors of a remote one
 
-  $ hg glog
+  $ hg log -G
   @  changeset:   5:cda648ca50f5
   |  tag:         tip
   |  user:        test
--- a/tests/test-parseindex2.py	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-parseindex2.py	Fri Dec 13 17:23:02 2013 -0600
@@ -1,11 +1,9 @@
+"""This unit test tests parsers.parse_index2()."""
+
 from mercurial import parsers
 from mercurial.node import nullid, nullrev
 import struct
 
-# This unit test compares the return value of the original Python
-# implementation of parseindex and the new C implementation for
-# an index file with and without inlined data
-
 # original python implementation
 def gettype(q):
     return int(q & 0xFFFF)
@@ -106,6 +104,9 @@
     else:
         print "Expected to get TypeError."
 
+   # Check parsers.parse_index2() on an index file against the original
+   # Python implementation of parseindex, both with and without inlined data.
+
     py_res_1 = py_parseindex(data_inlined, True)
     c_res_1 = parse_index2(data_inlined, True)
 
--- a/tests/test-patchbomb.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-patchbomb.t	Fri Dec 13 17:23:02 2013 -0600
@@ -2127,7 +2127,7 @@
   $ hg ci -md -d '4 0'
   $ echo d >> d
   $ hg ci -mdd -d '5 0'
-  $ hg --config extensions.graphlog= glog --template "{rev}:{node|short} {desc|firstline}\n"
+  $ hg log -G --template "{rev}:{node|short} {desc|firstline}\n"
   @  10:3b6f1ec9dde9 dd
   |
   o  9:2f9fa9b998c5 d
--- a/tests/test-permissions.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-permissions.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,4 +1,4 @@
-  $ "$TESTDIR/hghave" unix-permissions || exit 80
+#ifdef unix-permissions no-root
 
   $ hg init t
   $ cd t
@@ -70,3 +70,5 @@
   $ chmod +rx dir
 
   $ cd ..
+
+#endif
--- a/tests/test-phases-exchange.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-phases-exchange.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,9 +1,5 @@
   $ "$TESTDIR/hghave" killdaemons || exit 80
 
-  $ cat >> $HGRCPATH <<EOF
-  > [extensions]
-  > graphlog=
-  > EOF
   $ hgph() { hg log -G --template "{rev} {phase} {desc} - {node|short}\n" $*; }
 
   $ mkcommit() {
@@ -399,7 +395,7 @@
 
 initial setup
 
-  $ hg glog # of alpha
+  $ hg log -G # of alpha
   o  changeset:   6:145e75495359
   |  tag:         tip
   |  user:        test
@@ -1062,7 +1058,7 @@
   |
   o  0 public a-A - 054250a37db4
   
-#if unix-permissions
+#if unix-permissions no-root
 
 Pushing From an unlockable repo
 --------------------------------
--- a/tests/test-phases.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-phases.t	Fri Dec 13 17:23:02 2013 -0600
@@ -378,10 +378,6 @@
 
 initial picture
 
-  $ cat >> $HGRCPATH << EOF
-  > [extensions]
-  > hgext.graphlog=
-  > EOF
   $ hg log -G --template "{rev} {phase} {desc}\n"
   @    7 secret merge B' and E
   |\
--- a/tests/test-pull-permission.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-pull-permission.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,4 +1,4 @@
-  $ "$TESTDIR/hghave" unix-permissions || exit 80
+#if unix-permissions no-root
 
   $ hg init a
   $ cd a
@@ -30,3 +30,5 @@
   1 files, 1 changesets, 1 total revisions
 
   $ cd ..
+
+#endif
--- a/tests/test-push-warn.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-push-warn.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,3 @@
-  $ echo "[extensions]" >> $HGRCPATH
-  $ echo "graphlog=" >> $HGRCPATH
-
   $ hg init a
   $ cd a
   $ echo foo > t1
@@ -38,8 +35,8 @@
   query 2; still undecided: 1, sample size is: 1
   2 total queries
   listing keys for "bookmarks"
-  new remote heads on branch 'default'
-  new remote head 1e108cc5548c
+  new remote heads on branch 'default':
+   1e108cc5548c
   abort: push creates new remote head 1e108cc5548c!
   (pull and merge or see "hg help push" for details about pushing new heads)
   [255]
@@ -129,9 +126,9 @@
   $ hg push -v -r 3 -r 4 ../c
   pushing to ../c
   searching for changes
-  new remote heads on branch 'default'
-  new remote head a5dda829a167
-  new remote head ee8fbc7a0295
+  new remote heads on branch 'default':
+   a5dda829a167
+   ee8fbc7a0295
   abort: push creates new remote head a5dda829a167!
   (merge or see "hg help push" for details about pushing new heads)
   [255]
@@ -367,7 +364,7 @@
   $ hg push --branch f --new-branch ../f
   pushing to ../f
   searching for changes
-  abort: push creates multiple headed new branch 'f'
+  abort: push creates new branch 'f' with multiple heads
   (merge or see "hg help push" for details about pushing new heads)
   [255]
   $ hg push --branch f --new-branch --force ../f
@@ -532,7 +529,7 @@
 
 glog of local:
 
-  $ hg glog --template "{rev}: {branches} {desc}\n"
+  $ hg log -G --template "{rev}: {branches} {desc}\n"
   @  2: A a2
   |
   | o  1: B b
@@ -541,7 +538,7 @@
   
 glog of remote:
 
-  $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
+  $ hg log -G -R inner --template "{rev}: {branches} {desc}\n"
   @  2: B b1
   |
   o  1: B b
@@ -615,7 +612,7 @@
 
 glog of local:
 
-  $ hg glog --template "{rev}: {branches} {desc}\n"
+  $ hg log -G --template "{rev}: {branches} {desc}\n"
   @  3: A a2
   |
   o  2: A a1
@@ -626,7 +623,7 @@
   
 glog of remote:
 
-  $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
+  $ hg log -G -R inner --template "{rev}: {branches} {desc}\n"
   @  3: B b1
   |
   | o  2: A a1
@@ -700,7 +697,7 @@
 
 glog of local:
 
-  $ hg glog --template "{rev}: {branches} {desc}\n"
+  $ hg log -G --template "{rev}: {branches} {desc}\n"
   @  5: A b3
   |
   | o  4: B a3
@@ -715,7 +712,7 @@
   
 glog of remote:
 
-  $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
+  $ hg log -G -R inner --template "{rev}: {branches} {desc}\n"
   @  3: B b1
   |
   o  2: B b0
--- a/tests/test-rebase-abort.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-abort.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > 
   > [phases]
--- a/tests/test-rebase-bookmarks.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-bookmarks.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > 
   > [phases]
--- a/tests/test-rebase-cache.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-cache.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > mq=
   > 
--- a/tests/test-rebase-check-restore.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-check-restore.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > 
   > [phases]
--- a/tests/test-rebase-collapse.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-collapse.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > mq=
   > 
--- a/tests/test-rebase-conflicts.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-conflicts.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > 
   > [phases]
--- a/tests/test-rebase-detach.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-detach.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > 
   > [phases]
--- a/tests/test-rebase-interruptions.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-interruptions.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > 
   > [phases]
--- a/tests/test-rebase-issue-noparam-single-rev.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-issue-noparam-single-rev.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > 
   > [phases]
--- a/tests/test-rebase-mq-skip.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-mq-skip.t	Fri Dec 13 17:23:02 2013 -0600
@@ -3,7 +3,6 @@
 
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > mq=
   > 
--- a/tests/test-rebase-mq.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-mq.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > mq=
   > 
--- a/tests/test-rebase-named-branches.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-named-branches.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > 
   > [phases]
--- a/tests/test-rebase-newancestor.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-newancestor.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > 
   > [alias]
--- a/tests/test-rebase-parameters.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-parameters.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > 
   > [phases]
--- a/tests/test-rebase-pull.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-pull.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > 
   > [alias]
--- a/tests/test-rebase-rename.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-rename.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > 
   > [alias]
--- a/tests/test-rebase-scenario-global.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-rebase-scenario-global.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
-  > graphlog=
   > rebase=
   > 
   > [phases]
--- a/tests/test-repair-strip.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-repair-strip.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,4 +1,4 @@
-  $ "$TESTDIR/hghave" unix-permissions || exit 80
+#if unix-permissions no-root
 
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "mq=">> $HGRCPATH
@@ -130,3 +130,5 @@
   2 files, 2 changesets, 2 total revisions
 
   $ cd ..
+
+#endif
--- a/tests/test-revset-outgoing.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-revset-outgoing.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,7 +1,4 @@
   $ cat >> $HGRCPATH <<EOF
-  > [extensions]
-  > graphlog=
-  > 
   > [alias]
   > tlog = log --template "{rev}:{node|short}: '{desc}' {branches}\n"
   > tglog = tlog -G
--- a/tests/test-serve.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-serve.t	Fri Dec 13 17:23:02 2013 -0600
@@ -45,12 +45,14 @@
 
 With -v and -p daytime (should fail because low port)
 
+#if no-root
   $ KILLQUIETLY=Y
   $ hgserve -p daytime
   abort: cannot start server at 'localhost:13': Permission denied
   abort: child process failed to start
   % errors
   $ KILLQUIETLY=N
+#endif
 
 With --prefix foo
 
--- a/tests/test-strip-cross.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-strip-cross.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,7 +1,7 @@
 test stripping of filelogs where the linkrev doesn't always increase
 
   $ echo '[extensions]' >> $HGRCPATH
-  $ echo 'hgext.mq =' >> $HGRCPATH
+  $ echo 'strip =' >> $HGRCPATH
   $ hg init orig
   $ cd orig
   $ commit()
--- a/tests/test-strip.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-strip.t	Fri Dec 13 17:23:02 2013 -0600
@@ -1,6 +1,5 @@
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "strip=" >> $HGRCPATH
-  $ echo "graphlog=" >> $HGRCPATH
 
   $ restore() {
   >     hg unbundle -q .hg/strip-backup/*
@@ -226,7 +225,7 @@
 
   $ hg up
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ hg glog
+  $ hg log -G
   @  changeset:   4:264128213d29
   |  tag:         tip
   |  parent:      1:ef3a871183d7
@@ -259,7 +258,7 @@
 
   $ hg strip "roots(2)" 3
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
-  $ hg glog
+  $ hg log -G
   @  changeset:   2:264128213d29
   |  tag:         tip
   |  user:        test
@@ -277,7 +276,7 @@
      summary:     a
   
   $ restore
-  $ hg glog
+  $ hg log -G
   o  changeset:   4:443431ffac4f
   |  tag:         tip
   |  user:        test
@@ -311,7 +310,7 @@
   $ hg strip 2 4
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
-  $ hg glog
+  $ hg log -G
   o  changeset:   2:65bd5f99a4a3
   |  tag:         tip
   |  user:        test
--- a/tests/test-transplant.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-transplant.t	Fri Dec 13 17:23:02 2013 -0600
@@ -430,6 +430,20 @@
   adding manifests
   adding file changes
   added 4 changesets with 4 changes to 4 files
+
+test "--merge" causing pull from source repository on local host
+
+  $ hg --config extensions.mq= -q strip 2
+  $ hg transplant -s ../t --merge tip
+  searching for changes
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+  applying a53251cdf717
+  4:a53251cdf717 merged at 4831f4dc831a
+
   $ cd ..
 
 
--- a/tests/test-treediscovery-legacy.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-treediscovery-legacy.t	Fri Dec 13 17:23:02 2013 -0600
@@ -5,8 +5,6 @@
   $ cat >> $HGRCPATH <<EOF
   > [ui]
   > logtemplate="{rev} {node|short}: {desc} {branches}\n"
-  > [extensions]
-  > graphlog=
   > EOF
   $ cp $HGRCPATH $HGRCPATH-withcap
 
@@ -66,7 +64,7 @@
   $ hg init main
   $ cd main
   $ hg debugbuilddag -mo '+2:tbase @name1 +3:thead1 <tbase @name2 +4:thead2 @both /thead1 +2:tmaintip'
-  $ hg glog
+  $ hg log -G
   o  11 a19bfa7e7328: r11 both
   |
   o  10 8b6bad1512e1: r10 both
--- a/tests/test-treediscovery.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-treediscovery.t	Fri Dec 13 17:23:02 2013 -0600
@@ -7,8 +7,6 @@
   $ cat >> $HGRCPATH <<EOF
   > [ui]
   > logtemplate="{rev} {node|short}: {desc} {branches}\n"
-  > [extensions]
-  > graphlog=
   > EOF
 
 Setup HTTP server control:
@@ -53,7 +51,7 @@
   $ hg init main
   $ cd main
   $ hg debugbuilddag -mo '+2:tbase @name1 +3:thead1 <tbase @name2 +4:thead2 @both /thead1 +2:tmaintip'
-  $ hg glog
+  $ hg log -G
   o  11 a19bfa7e7328: r11 both
   |
   o  10 8b6bad1512e1: r10 both
--- a/tests/test-update-branches.t	Wed Dec 04 13:42:28 2013 -0600
+++ b/tests/test-update-branches.t	Fri Dec 13 17:23:02 2013 -0600
@@ -34,8 +34,7 @@
 
 Initial repo state:
 
-  $ hg --config 'extensions.graphlog=' \
-  >    glog --template '{rev}:{node|short} {parents} {branches}\n'
+  $ hg log -G --template '{rev}:{node|short} {parents} {branches}\n'
   @  5:ff252e8273df  b1
   |
   o  4:d047485b3896 0:60829823a42a  b1