Show More
@@ -187,7 +187,7 b' osx:' | |||
|
187 | 187 | PREFIX=/usr/local \ |
|
188 | 188 | clean install |
|
189 | 189 | mkdir -p $${OUTPUTDIR:-dist} |
|
190 |
HGVER=$$( |
|
|
190 | HGVER=$$(python contrib/genosxversion.py $(OSXVERSIONFLAGS) build/mercurial/Library/Python/2.7/site-packages/mercurial/__version__.py) && \ | |
|
191 | 191 | OSXVER=$$(sw_vers -productVersion | cut -d. -f1,2) && \ |
|
192 | 192 | pkgbuild --filter \\.DS_Store --root build/mercurial/ \ |
|
193 | 193 | --identifier org.mercurial-scm.mercurial \ |
@@ -406,7 +406,8 b' class revbranchcache(object):' | |||
|
406 | 406 | |
|
407 | 407 | # fast path: extract data from cache, use it if node is matching |
|
408 | 408 | reponode = changelog.node(rev)[:_rbcnodelen] |
|
409 |
cachenode, branchidx = unpack_from( |
|
|
409 | cachenode, branchidx = unpack_from( | |
|
410 | _rbcrecfmt, util.buffer(self._rbcrevs), rbcrevidx) | |
|
410 | 411 | close = bool(branchidx & _rbccloseflag) |
|
411 | 412 | if close: |
|
412 | 413 | branchidx &= _rbcbranchidxmask |
@@ -3335,7 +3335,9 b' def log(ui, repo, *pats, **opts):' | |||
|
3335 | 3335 | revisions. |
|
3336 | 3336 | |
|
3337 | 3337 | See :hg:`help templates` for more about pre-packaged styles and |
|
3338 | specifying custom templates. | |
|
3338 | specifying custom templates. The default template used by the log | |
|
3339 | command can be customized via the ``ui.logtemplate`` configuration | |
|
3340 | setting. | |
|
3339 | 3341 | |
|
3340 | 3342 | Returns 0 on success. |
|
3341 | 3343 |
@@ -208,10 +208,22 b' def getlatesttags(repo, ctx, cache, patt' | |||
|
208 | 208 | latesttags[rev] = ctx.date()[0], 0, [t for t in sorted(tags)] |
|
209 | 209 | continue |
|
210 | 210 | try: |
|
211 | ptags = [latesttags[p.rev()] for p in ctx.parents()] | |
|
212 | if len(ptags) > 1: | |
|
213 | if ptags[0][2] == ptags[1][2]: | |
|
211 | 214 | # The tuples are laid out so the right one can be found by |
|
212 | # comparison. | |
|
213 | pdate, pdist, ptag = max( | |
|
214 | latesttags[p.rev()] for p in ctx.parents()) | |
|
215 | # comparison in this case. | |
|
216 | pdate, pdist, ptag = max(ptags) | |
|
217 | else: | |
|
218 | def key(x): | |
|
219 | changessincetag = len(repo.revs('only(%d, %s)', | |
|
220 | ctx.rev(), x[2][0])) | |
|
221 | # Smallest number of changes since tag wins. Date is | |
|
222 | # used as tiebreaker. | |
|
223 | return [-changessincetag, x[0]] | |
|
224 | pdate, pdist, ptag = max(ptags, key=key) | |
|
225 | else: | |
|
226 | pdate, pdist, ptag = ptags[0] | |
|
215 | 227 | except KeyError: |
|
216 | 228 | # Cache miss - recurse |
|
217 | 229 | todo.append(rev) |
@@ -904,6 +904,7 b' class ui(object):' | |||
|
904 | 904 | if not getattr(self.ferr, 'closed', False): |
|
905 | 905 | self.ferr.flush() |
|
906 | 906 | except IOError as inst: |
|
907 | if inst.errno not in (errno.EPIPE, errno.EIO, errno.EBADF): | |
|
907 | 908 | raise error.StdioError(inst) |
|
908 | 909 | |
|
909 | 910 | def flush(self): |
@@ -913,11 +914,13 b' class ui(object):' | |||
|
913 | 914 | try: |
|
914 | 915 | self.fout.flush() |
|
915 | 916 | except IOError as err: |
|
917 | if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF): | |
|
916 | 918 | raise error.StdioError(err) |
|
917 | 919 | finally: |
|
918 | 920 | try: |
|
919 | 921 | self.ferr.flush() |
|
920 | 922 | except IOError as err: |
|
923 | if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF): | |
|
921 | 924 | raise error.StdioError(err) |
|
922 | 925 | finally: |
|
923 | 926 | self._blockedtimes['stdio_blocked'] += \ |
@@ -785,11 +785,11 b' try:' | |||
|
785 | 785 | from distutils import cygwinccompiler |
|
786 | 786 | |
|
787 | 787 | # the -mno-cygwin option has been deprecated for years |
|
788 | compiler = cygwinccompiler.Mingw32CCompiler | |
|
788 | mingw32compilerclass = cygwinccompiler.Mingw32CCompiler | |
|
789 | 789 | |
|
790 | 790 | class HackedMingw32CCompiler(cygwinccompiler.Mingw32CCompiler): |
|
791 | 791 | def __init__(self, *args, **kwargs): |
|
792 | compiler.__init__(self, *args, **kwargs) | |
|
792 | mingw32compilerclass.__init__(self, *args, **kwargs) | |
|
793 | 793 | for i in 'compiler compiler_so linker_exe linker_so'.split(): |
|
794 | 794 | try: |
|
795 | 795 | getattr(self, i).remove('-mno-cygwin') |
@@ -810,11 +810,11 b" if os.name == 'nt':" | |||
|
810 | 810 | # effect. |
|
811 | 811 | from distutils import msvccompiler |
|
812 | 812 | |
|
813 | compiler = msvccompiler.MSVCCompiler | |
|
813 | msvccompilerclass = msvccompiler.MSVCCompiler | |
|
814 | 814 | |
|
815 | 815 | class HackedMSVCCompiler(msvccompiler.MSVCCompiler): |
|
816 | 816 | def initialize(self): |
|
817 | compiler.initialize(self) | |
|
817 | msvccompilerclass.initialize(self) | |
|
818 | 818 | # "warning LNK4197: export 'func' specified multiple times" |
|
819 | 819 | self.ldflags_shared.append('/ignore:4197') |
|
820 | 820 | self.ldflags_shared_debug.append('/ignore:4197') |
@@ -883,7 +883,7 b' file specified by acl.config does not ex' | |||
|
883 | 883 | added 3 changesets with 3 changes to 3 files |
|
884 | 884 | calling hook pretxnchangegroup.acl: hgext.acl.hook |
|
885 | 885 | acl: checking access for user "barney" |
|
886 |
error: pretxnchangegroup.acl hook raised an exception: [Errno |
|
|
886 | error: pretxnchangegroup.acl hook raised an exception: [Errno *] * (glob) | |
|
887 | 887 | bundle2-input-part: total payload size 1553 |
|
888 | 888 | bundle2-input-bundle: 3 parts total |
|
889 | 889 | transaction abort! |
@@ -2871,95 +2871,189 b' latesttag:' | |||
|
2871 | 2871 | |
|
2872 | 2872 | No tag set: |
|
2873 | 2873 | |
|
2874 | $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n' | |
|
2875 | 5: null+5 | |
|
2876 | 4: null+4 | |
|
2877 |
|
|
|
2878 | 2: null+3 | |
|
2879 |
|
|
|
2880 | 0: null+1 | |
|
2881 | ||
|
2882 | One common tag: longest path wins: | |
|
2874 | $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n' | |
|
2875 | @ 5: null+5 | |
|
2876 | |\ | |
|
2877 | | o 4: null+4 | |
|
2878 | | | | |
|
2879 | | o 3: null+3 | |
|
2880 | | | | |
|
2881 | o | 2: null+3 | |
|
2882 | |/ | |
|
2883 | o 1: null+2 | |
|
2884 | | | |
|
2885 | o 0: null+1 | |
|
2886 | ||
|
2887 | ||
|
2888 | One common tag: longest path wins for {latesttagdistance}: | |
|
2883 | 2889 | |
|
2884 | 2890 | $ hg tag -r 1 -m t1 -d '6 0' t1 |
|
2885 | $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n' | |
|
2886 | 6: t1+4 | |
|
2887 | 5: t1+3 | |
|
2888 |
|
|
|
2889 | 3: t1+1 | |
|
2890 |
|
|
|
2891 | 1: t1+0 | |
|
2892 | 0: null+1 | |
|
2893 | ||
|
2894 | One ancestor tag: more recent wins: | |
|
2891 | $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n' | |
|
2892 | @ 6: t1+4 | |
|
2893 | | | |
|
2894 | o 5: t1+3 | |
|
2895 | |\ | |
|
2896 | | o 4: t1+2 | |
|
2897 | | | | |
|
2898 | | o 3: t1+1 | |
|
2899 | | | | |
|
2900 | o | 2: t1+1 | |
|
2901 | |/ | |
|
2902 | o 1: t1+0 | |
|
2903 | | | |
|
2904 | o 0: null+1 | |
|
2905 | ||
|
2906 | ||
|
2907 | One ancestor tag: closest wins: | |
|
2895 | 2908 | |
|
2896 | 2909 | $ hg tag -r 2 -m t2 -d '7 0' t2 |
|
2897 | $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n' | |
|
2898 | 7: t2+3 | |
|
2899 | 6: t2+2 | |
|
2900 |
|
|
|
2901 | 4: t1+2 | |
|
2902 |
|
|
|
2903 | 2: t2+0 | |
|
2904 |
|
|
|
2905 | 0: null+1 | |
|
2906 | ||
|
2907 | Two branch tags: more recent wins: | |
|
2910 | $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n' | |
|
2911 | @ 7: t2+3 | |
|
2912 | | | |
|
2913 | o 6: t2+2 | |
|
2914 | | | |
|
2915 | o 5: t2+1 | |
|
2916 | |\ | |
|
2917 | | o 4: t1+2 | |
|
2918 | | | | |
|
2919 | | o 3: t1+1 | |
|
2920 | | | | |
|
2921 | o | 2: t2+0 | |
|
2922 | |/ | |
|
2923 | o 1: t1+0 | |
|
2924 | | | |
|
2925 | o 0: null+1 | |
|
2926 | ||
|
2927 | ||
|
2928 | Two branch tags: more recent wins if same number of changes: | |
|
2908 | 2929 | |
|
2909 | 2930 | $ hg tag -r 3 -m t3 -d '8 0' t3 |
|
2910 | $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n' | |
|
2911 | 8: t3+5 | |
|
2912 | 7: t3+4 | |
|
2913 |
|
|
|
2914 | 5: t3+2 | |
|
2915 |
|
|
|
2916 | 3: t3+0 | |
|
2917 | 2: t2+0 | |
|
2918 | 1: t1+0 | |
|
2919 | 0: null+1 | |
|
2931 | $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n' | |
|
2932 | @ 8: t3+5 | |
|
2933 | | | |
|
2934 | o 7: t3+4 | |
|
2935 | | | |
|
2936 | o 6: t3+3 | |
|
2937 | | | |
|
2938 | o 5: t3+2 | |
|
2939 | |\ | |
|
2940 | | o 4: t3+1 | |
|
2941 | | | | |
|
2942 | | o 3: t3+0 | |
|
2943 | | | | |
|
2944 | o | 2: t2+0 | |
|
2945 | |/ | |
|
2946 | o 1: t1+0 | |
|
2947 | | | |
|
2948 | o 0: null+1 | |
|
2949 | ||
|
2950 | ||
|
2951 | Two branch tags: fewest changes wins: | |
|
2952 | ||
|
2953 | $ hg tag -r 4 -m t4 -d '4 0' t4 # older than t2, but should not matter | |
|
2954 | $ hg log -G --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n" | |
|
2955 | @ 9: t4+5,6 | |
|
2956 | | | |
|
2957 | o 8: t4+4,5 | |
|
2958 | | | |
|
2959 | o 7: t4+3,4 | |
|
2960 | | | |
|
2961 | o 6: t4+2,3 | |
|
2962 | | | |
|
2963 | o 5: t4+1,2 | |
|
2964 | |\ | |
|
2965 | | o 4: t4+0,0 | |
|
2966 | | | | |
|
2967 | | o 3: t3+0,0 | |
|
2968 | | | | |
|
2969 | o | 2: t2+0,0 | |
|
2970 | |/ | |
|
2971 | o 1: t1+0,0 | |
|
2972 | | | |
|
2973 | o 0: null+1,1 | |
|
2974 | ||
|
2920 | 2975 | |
|
2921 | 2976 | Merged tag overrides: |
|
2922 | 2977 | |
|
2923 | 2978 | $ hg tag -r 5 -m t5 -d '9 0' t5 |
|
2924 | 2979 | $ hg tag -r 3 -m at3 -d '10 0' at3 |
|
2925 | $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n' | |
|
2926 |
|
|
|
2927 | 9: t5+4 | |
|
2928 |
|
|
|
2929 | 7: t5+2 | |
|
2930 |
|
|
|
2931 | 5: t5+0 | |
|
2932 | 4: at3:t3+1 | |
|
2933 | 3: at3:t3+0 | |
|
2934 | 2: t2+0 | |
|
2935 | 1: t1+0 | |
|
2936 | 0: null+1 | |
|
2937 | ||
|
2938 | $ hg log --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n" | |
|
2939 | 10: t5+5,5 | |
|
2940 | 9: t5+4,4 | |
|
2941 | 8: t5+3,3 | |
|
2942 | 7: t5+2,2 | |
|
2943 | 6: t5+1,1 | |
|
2944 | 5: t5+0,0 | |
|
2945 | 4: at3+1,1 t3+1,1 | |
|
2946 | 3: at3+0,0 t3+0,0 | |
|
2947 | 2: t2+0,0 | |
|
2948 | 1: t1+0,0 | |
|
2949 | 0: null+1,1 | |
|
2950 | ||
|
2951 |
$ hg log --template "{rev}: {latesttag |
|
|
2952 | 10: t3, C: 8, D: 7 | |
|
2953 | 9: t3, C: 7, D: 6 | |
|
2954 | 8: t3, C: 6, D: 5 | |
|
2955 | 7: t3, C: 5, D: 4 | |
|
2956 | 6: t3, C: 4, D: 3 | |
|
2957 | 5: t3, C: 3, D: 2 | |
|
2958 | 4: t3, C: 1, D: 1 | |
|
2959 | 3: t3, C: 0, D: 0 | |
|
2960 | 2: t1, C: 1, D: 1 | |
|
2961 | 1: t1, C: 0, D: 0 | |
|
2962 | 0: null, C: 1, D: 1 | |
|
2980 | $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n' | |
|
2981 | @ 11: t5+6 | |
|
2982 | | | |
|
2983 | o 10: t5+5 | |
|
2984 | | | |
|
2985 | o 9: t5+4 | |
|
2986 | | | |
|
2987 | o 8: t5+3 | |
|
2988 | | | |
|
2989 | o 7: t5+2 | |
|
2990 | | | |
|
2991 | o 6: t5+1 | |
|
2992 | | | |
|
2993 | o 5: t5+0 | |
|
2994 | |\ | |
|
2995 | | o 4: t4+0 | |
|
2996 | | | | |
|
2997 | | o 3: at3:t3+0 | |
|
2998 | | | | |
|
2999 | o | 2: t2+0 | |
|
3000 | |/ | |
|
3001 | o 1: t1+0 | |
|
3002 | | | |
|
3003 | o 0: null+1 | |
|
3004 | ||
|
3005 | ||
|
3006 | $ hg log -G --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n" | |
|
3007 | @ 11: t5+6,6 | |
|
3008 | | | |
|
3009 | o 10: t5+5,5 | |
|
3010 | | | |
|
3011 | o 9: t5+4,4 | |
|
3012 | | | |
|
3013 | o 8: t5+3,3 | |
|
3014 | | | |
|
3015 | o 7: t5+2,2 | |
|
3016 | | | |
|
3017 | o 6: t5+1,1 | |
|
3018 | | | |
|
3019 | o 5: t5+0,0 | |
|
3020 | |\ | |
|
3021 | | o 4: t4+0,0 | |
|
3022 | | | | |
|
3023 | | o 3: at3+0,0 t3+0,0 | |
|
3024 | | | | |
|
3025 | o | 2: t2+0,0 | |
|
3026 | |/ | |
|
3027 | o 1: t1+0,0 | |
|
3028 | | | |
|
3029 | o 0: null+1,1 | |
|
3030 | ||
|
3031 | ||
|
3032 | $ hg log -G --template "{rev}: {latesttag('re:^t[13]$') % '{tag}, C: {changes}, D: {distance}'}\n" | |
|
3033 | @ 11: t3, C: 9, D: 8 | |
|
3034 | | | |
|
3035 | o 10: t3, C: 8, D: 7 | |
|
3036 | | | |
|
3037 | o 9: t3, C: 7, D: 6 | |
|
3038 | | | |
|
3039 | o 8: t3, C: 6, D: 5 | |
|
3040 | | | |
|
3041 | o 7: t3, C: 5, D: 4 | |
|
3042 | | | |
|
3043 | o 6: t3, C: 4, D: 3 | |
|
3044 | | | |
|
3045 | o 5: t3, C: 3, D: 2 | |
|
3046 | |\ | |
|
3047 | | o 4: t3, C: 1, D: 1 | |
|
3048 | | | | |
|
3049 | | o 3: t3, C: 0, D: 0 | |
|
3050 | | | | |
|
3051 | o | 2: t1, C: 1, D: 1 | |
|
3052 | |/ | |
|
3053 | o 1: t1, C: 0, D: 0 | |
|
3054 | | | |
|
3055 | o 0: null, C: 1, D: 1 | |
|
3056 | ||
|
2963 | 3057 | |
|
2964 | 3058 | $ cd .. |
|
2965 | 3059 | |
@@ -2981,7 +3075,7 b' if it is a relative path' | |||
|
2981 | 3075 | > EOF |
|
2982 | 3076 | |
|
2983 | 3077 | $ hg -R latesttag tip |
|
2984 | test 10:9b4a630e5f5f | |
|
3078 | test 11:97e5943b523a | |
|
2985 | 3079 | |
|
2986 | 3080 | Test recursive showlist template (issue1989): |
|
2987 | 3081 | |
@@ -2994,7 +3088,7 b' Test recursive showlist template (issue1' | |||
|
2994 | 3088 | |
|
2995 | 3089 | $ hg -R latesttag log -r tip --style=style1989 |
|
2996 | 3090 | M|test |
|
2997 |
1 |
|
|
3091 | 11,test | |
|
2998 | 3092 | branch: test |
|
2999 | 3093 | |
|
3000 | 3094 | Test new-style inline templating: |
@@ -3027,6 +3121,7 b' Test the strip function with chars speci' | |||
|
3027 | 3121 | $ hg log -R latesttag --template '{desc}\n' |
|
3028 | 3122 | at3 |
|
3029 | 3123 | t5 |
|
3124 | t4 | |
|
3030 | 3125 | t3 |
|
3031 | 3126 | t2 |
|
3032 | 3127 | t1 |
@@ -3040,6 +3135,7 b' Test the strip function with chars speci' | |||
|
3040 | 3135 | $ hg log -R latesttag --template '{strip(desc, "te")}\n' |
|
3041 | 3136 | at3 |
|
3042 | 3137 | 5 |
|
3138 | 4 | |
|
3043 | 3139 | 3 |
|
3044 | 3140 | 2 |
|
3045 | 3141 | 1 |
@@ -3055,6 +3151,7 b' Test date format:' | |||
|
3055 | 3151 | $ hg log -R latesttag --template 'date: {date(date, "%y %m %d %S %z")}\n' |
|
3056 | 3152 | date: 70 01 01 10 +0000 |
|
3057 | 3153 | date: 70 01 01 09 +0000 |
|
3154 | date: 70 01 01 04 +0000 | |
|
3058 | 3155 | date: 70 01 01 08 +0000 |
|
3059 | 3156 | date: 70 01 01 07 +0000 |
|
3060 | 3157 | date: 70 01 01 06 +0000 |
@@ -24,11 +24,10 b" os.utime('foo', (1000, 1000))" | |||
|
24 | 24 | repo[None].add(['foo']) |
|
25 | 25 | repo.commit(text='commit1', date="0 0") |
|
26 | 26 | |
|
27 | d = repo[None]['foo'].date() | |
|
27 | 28 | if os.name == 'nt': |
|
28 | d = repo[None]['foo'].date() | |
|
29 |
|
|
|
30 | else: | |
|
31 | print("workingfilectx.date =", repo[None]['foo'].date()) | |
|
29 | d = d[:2] | |
|
30 | print("workingfilectx.date = (%d, %d)" % d) | |
|
32 | 31 | |
|
33 | 32 | # test memctx with non-ASCII commit message |
|
34 | 33 |
@@ -210,3 +210,248 b' rollback disabled by config' | |||
|
210 | 210 | abort: rollback is disabled because it is unsafe |
|
211 | 211 | (see `hg help -v rollback` for information) |
|
212 | 212 | [255] |
|
213 | ||
|
214 | $ cd .. | |
|
215 | ||
|
216 | I/O errors on stdio are handled properly (issue5658) | |
|
217 | ||
|
218 | $ cat > badui.py << EOF | |
|
219 | > import errno | |
|
220 | > from mercurial.i18n import _ | |
|
221 | > from mercurial import ( | |
|
222 | > error, | |
|
223 | > ui as uimod, | |
|
224 | > ) | |
|
225 | > | |
|
226 | > def pretxncommit(ui, repo, **kwargs): | |
|
227 | > ui.warn('warn during pretxncommit\n') | |
|
228 | > | |
|
229 | > def pretxnclose(ui, repo, **kwargs): | |
|
230 | > ui.warn('warn during pretxnclose\n') | |
|
231 | > | |
|
232 | > def txnclose(ui, repo, **kwargs): | |
|
233 | > ui.warn('warn during txnclose\n') | |
|
234 | > | |
|
235 | > def txnabort(ui, repo, **kwargs): | |
|
236 | > ui.warn('warn during abort\n') | |
|
237 | > | |
|
238 | > class fdproxy(object): | |
|
239 | > def __init__(self, ui, o): | |
|
240 | > self._ui = ui | |
|
241 | > self._o = o | |
|
242 | > | |
|
243 | > def __getattr__(self, attr): | |
|
244 | > return getattr(self._o, attr) | |
|
245 | > | |
|
246 | > def write(self, msg): | |
|
247 | > errors = set(self._ui.configlist('ui', 'ioerrors', [])) | |
|
248 | > pretxncommit = msg == 'warn during pretxncommit\n' | |
|
249 | > pretxnclose = msg == 'warn during pretxnclose\n' | |
|
250 | > txnclose = msg == 'warn during txnclose\n' | |
|
251 | > txnabort = msg == 'warn during abort\n' | |
|
252 | > msgabort = msg == _('transaction abort!\n') | |
|
253 | > msgrollback = msg == _('rollback completed\n') | |
|
254 | > | |
|
255 | > if pretxncommit and 'pretxncommit' in errors: | |
|
256 | > raise IOError(errno.EPIPE, 'simulated epipe') | |
|
257 | > if pretxnclose and 'pretxnclose' in errors: | |
|
258 | > raise IOError(errno.EIO, 'simulated eio') | |
|
259 | > if txnclose and 'txnclose' in errors: | |
|
260 | > raise IOError(errno.EBADF, 'simulated badf') | |
|
261 | > if txnabort and 'txnabort' in errors: | |
|
262 | > raise IOError(errno.EPIPE, 'simulated epipe') | |
|
263 | > if msgabort and 'msgabort' in errors: | |
|
264 | > raise IOError(errno.EBADF, 'simulated ebadf') | |
|
265 | > if msgrollback and 'msgrollback' in errors: | |
|
266 | > raise IOError(errno.EIO, 'simulated eio') | |
|
267 | > | |
|
268 | > return self._o.write(msg) | |
|
269 | > | |
|
270 | > def uisetup(ui): | |
|
271 | > class badui(ui.__class__): | |
|
272 | > def write_err(self, *args, **kwargs): | |
|
273 | > olderr = self.ferr | |
|
274 | > try: | |
|
275 | > self.ferr = fdproxy(self, olderr) | |
|
276 | > return super(badui, self).write_err(*args, **kwargs) | |
|
277 | > finally: | |
|
278 | > self.ferr = olderr | |
|
279 | > | |
|
280 | > ui.__class__ = badui | |
|
281 | > | |
|
282 | > def reposetup(ui, repo): | |
|
283 | > ui.setconfig('hooks', 'pretxnclose.badui', pretxnclose, 'badui') | |
|
284 | > ui.setconfig('hooks', 'txnclose.badui', txnclose, 'badui') | |
|
285 | > ui.setconfig('hooks', 'pretxncommit.badui', pretxncommit, 'badui') | |
|
286 | > ui.setconfig('hooks', 'txnabort.badui', txnabort, 'badui') | |
|
287 | > EOF | |
|
288 | ||
|
289 | $ cat >> $HGRCPATH << EOF | |
|
290 | > [extensions] | |
|
291 | > badui = $TESTTMP/badui.py | |
|
292 | > EOF | |
|
293 | ||
|
294 | An I/O error during pretxncommit is handled | |
|
295 | ||
|
296 | $ hg init ioerror-pretxncommit | |
|
297 | $ cd ioerror-pretxncommit | |
|
298 | $ echo 0 > foo | |
|
299 | $ hg -q commit -A -m initial | |
|
300 | warn during pretxncommit | |
|
301 | warn during pretxnclose | |
|
302 | warn during txnclose | |
|
303 | $ echo 1 > foo | |
|
304 | $ hg --config ui.ioerrors=pretxncommit commit -m 'error during pretxncommit' | |
|
305 | warn during pretxnclose | |
|
306 | warn during txnclose | |
|
307 | ||
|
308 | $ hg commit -m 'commit 1' | |
|
309 | nothing changed | |
|
310 | [1] | |
|
311 | ||
|
312 | $ cd .. | |
|
313 | ||
|
314 | An I/O error during pretxnclose is handled | |
|
315 | ||
|
316 | $ hg init ioerror-pretxnclose | |
|
317 | $ cd ioerror-pretxnclose | |
|
318 | $ echo 0 > foo | |
|
319 | $ hg -q commit -A -m initial | |
|
320 | warn during pretxncommit | |
|
321 | warn during pretxnclose | |
|
322 | warn during txnclose | |
|
323 | ||
|
324 | $ echo 1 > foo | |
|
325 | $ hg --config ui.ioerrors=pretxnclose commit -m 'error during pretxnclose' | |
|
326 | warn during pretxncommit | |
|
327 | warn during txnclose | |
|
328 | ||
|
329 | $ hg commit -m 'commit 1' | |
|
330 | nothing changed | |
|
331 | [1] | |
|
332 | ||
|
333 | $ cd .. | |
|
334 | ||
|
335 | An I/O error during txnclose is handled | |
|
336 | ||
|
337 | $ hg init ioerror-txnclose | |
|
338 | $ cd ioerror-txnclose | |
|
339 | $ echo 0 > foo | |
|
340 | $ hg -q commit -A -m initial | |
|
341 | warn during pretxncommit | |
|
342 | warn during pretxnclose | |
|
343 | warn during txnclose | |
|
344 | ||
|
345 | $ echo 1 > foo | |
|
346 | $ hg --config ui.ioerrors=txnclose commit -m 'error during txnclose' | |
|
347 | warn during pretxncommit | |
|
348 | warn during pretxnclose | |
|
349 | ||
|
350 | $ hg commit -m 'commit 1' | |
|
351 | nothing changed | |
|
352 | [1] | |
|
353 | ||
|
354 | $ cd .. | |
|
355 | ||
|
356 | An I/O error writing "transaction abort" is handled | |
|
357 | ||
|
358 | $ hg init ioerror-msgabort | |
|
359 | $ cd ioerror-msgabort | |
|
360 | ||
|
361 | $ echo 0 > foo | |
|
362 | $ hg -q commit -A -m initial | |
|
363 | warn during pretxncommit | |
|
364 | warn during pretxnclose | |
|
365 | warn during txnclose | |
|
366 | ||
|
367 | $ echo 1 > foo | |
|
368 | $ hg --config ui.ioerrors=msgabort --config hooks.pretxncommit=false commit -m 'error during abort message' | |
|
369 | warn during abort | |
|
370 | rollback completed | |
|
371 | abort: pretxncommit hook exited with status 1 | |
|
372 | [255] | |
|
373 | ||
|
374 | $ hg commit -m 'commit 1' | |
|
375 | warn during pretxncommit | |
|
376 | warn during pretxnclose | |
|
377 | warn during txnclose | |
|
378 | ||
|
379 | $ cd .. | |
|
380 | ||
|
381 | An I/O error during txnabort should still result in rollback | |
|
382 | ||
|
383 | $ hg init ioerror-txnabort | |
|
384 | $ cd ioerror-txnabort | |
|
385 | ||
|
386 | $ echo 0 > foo | |
|
387 | $ hg -q commit -A -m initial | |
|
388 | warn during pretxncommit | |
|
389 | warn during pretxnclose | |
|
390 | warn during txnclose | |
|
391 | ||
|
392 | $ echo 1 > foo | |
|
393 | $ hg --config ui.ioerrors=txnabort --config hooks.pretxncommit=false commit -m 'error during abort' | |
|
394 | transaction abort! | |
|
395 | rollback completed | |
|
396 | abort: pretxncommit hook exited with status 1 | |
|
397 | [255] | |
|
398 | ||
|
399 | $ hg commit -m 'commit 1' | |
|
400 | warn during pretxncommit | |
|
401 | warn during pretxnclose | |
|
402 | warn during txnclose | |
|
403 | ||
|
404 | $ cd .. | |
|
405 | ||
|
406 | An I/O error writing "rollback completed" is handled | |
|
407 | ||
|
408 | $ hg init ioerror-msgrollback | |
|
409 | $ cd ioerror-msgrollback | |
|
410 | ||
|
411 | $ echo 0 > foo | |
|
412 | $ hg -q commit -A -m initial | |
|
413 | warn during pretxncommit | |
|
414 | warn during pretxnclose | |
|
415 | warn during txnclose | |
|
416 | ||
|
417 | $ echo 1 > foo | |
|
418 | ||
|
419 | $ hg --config ui.ioerrors=msgrollback --config hooks.pretxncommit=false commit -m 'error during rollback message' | |
|
420 | transaction abort! | |
|
421 | warn during abort | |
|
422 | abort: pretxncommit hook exited with status 1 | |
|
423 | [255] | |
|
424 | ||
|
425 | $ hg verify | |
|
426 | checking changesets | |
|
427 | checking manifests | |
|
428 | crosschecking files in changesets and manifests | |
|
429 | checking files | |
|
430 | 1 files, 1 changesets, 1 total revisions | |
|
431 | ||
|
432 | $ cd .. | |
|
433 | ||
|
434 | Multiple I/O errors after transaction open are handled. | |
|
435 | This is effectively what happens if a peer disconnects in the middle | |
|
436 | of a transaction. | |
|
437 | ||
|
438 | $ hg init ioerror-multiple | |
|
439 | $ cd ioerror-multiple | |
|
440 | $ echo 0 > foo | |
|
441 | $ hg -q commit -A -m initial | |
|
442 | warn during pretxncommit | |
|
443 | warn during pretxnclose | |
|
444 | warn during txnclose | |
|
445 | ||
|
446 | $ echo 1 > foo | |
|
447 | ||
|
448 | $ hg --config ui.ioerrors=pretxncommit,pretxnclose,txnclose,txnabort,msgabort,msgrollback commit -m 'multiple errors' | |
|
449 | ||
|
450 | $ hg verify | |
|
451 | checking changesets | |
|
452 | checking manifests | |
|
453 | crosschecking files in changesets and manifests | |
|
454 | checking files | |
|
455 | 1 files, 2 changesets, 2 total revisions | |
|
456 | ||
|
457 | $ cd .. |
@@ -381,7 +381,7 b' Errors writing to .hgtags fnodes cache a' | |||
|
381 | 381 | |
|
382 | 382 | $ hg blackbox -l 6 |
|
383 | 383 | 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags |
|
384 |
1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> couldn't write cache/hgtagsfnodes1: [Errno |
|
|
384 | 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> couldn't write cache/hgtagsfnodes1: [Errno *] * (glob) | |
|
385 | 385 | 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> 2/3 cache hits/lookups in * seconds (glob) |
|
386 | 386 | 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing .hg/cache/tags2-visible with 1 tags |
|
387 | 387 | 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags exited 0 after * seconds (glob) |
General Comments 0
You need to be logged in to leave comments.
Login now