Show More
@@ -503,6 +503,20 b' def pushkey(repo, proto, namespace, key,' | |||||
503 | else: |
|
503 | else: | |
504 | new = encoding.tolocal(new) # normal path |
|
504 | new = encoding.tolocal(new) # normal path | |
505 |
|
505 | |||
|
506 | if util.safehasattr(proto, 'restore'): | |||
|
507 | ||||
|
508 | proto.redirect() | |||
|
509 | ||||
|
510 | try: | |||
|
511 | r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key), | |||
|
512 | encoding.tolocal(old), new) or False | |||
|
513 | except util.Abort: | |||
|
514 | r = False | |||
|
515 | ||||
|
516 | output = proto.restore() | |||
|
517 | ||||
|
518 | return '%s\n%s' % (int(r), output) | |||
|
519 | ||||
506 | r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key), |
|
520 | r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key), | |
507 | encoding.tolocal(old), new) |
|
521 | encoding.tolocal(old), new) | |
508 | return '%s\n' % int(r) |
|
522 | return '%s\n' % int(r) |
@@ -59,6 +59,7 b' expect success' | |||||
59 | $ echo 'allow_push = *' >> .hg/hgrc |
|
59 | $ echo 'allow_push = *' >> .hg/hgrc | |
60 | $ echo '[hooks]' >> .hg/hgrc |
|
60 | $ echo '[hooks]' >> .hg/hgrc | |
61 | $ echo "changegroup = python \"$TESTDIR/printenv.py\" changegroup 0" >> .hg/hgrc |
|
61 | $ echo "changegroup = python \"$TESTDIR/printenv.py\" changegroup 0" >> .hg/hgrc | |
|
62 | $ echo "pushkey = python \"$TESTDIR/printenv.py\" pushkey 0" >> .hg/hgrc | |||
62 | $ req |
|
63 | $ req | |
63 | pushing to http://localhost:$HGPORT/ |
|
64 | pushing to http://localhost:$HGPORT/ | |
64 | searching for changes |
|
65 | searching for changes | |
@@ -67,6 +68,7 b' expect success' | |||||
67 | remote: adding file changes |
|
68 | remote: adding file changes | |
68 | remote: added 1 changesets with 1 changes to 1 files |
|
69 | remote: added 1 changesets with 1 changes to 1 files | |
69 | remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*: (glob) |
|
70 | remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*: (glob) | |
|
71 | remote: pushkey hook: HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_OLD=1 HG_RET=1 | |||
70 | % serve errors |
|
72 | % serve errors | |
71 | $ hg rollback |
|
73 | $ hg rollback | |
72 | repository tip rolled back to revision 0 (undo serve) |
|
74 | repository tip rolled back to revision 0 (undo serve) | |
@@ -83,6 +85,7 b' expect success, server lacks the httphea' | |||||
83 | remote: adding file changes |
|
85 | remote: adding file changes | |
84 | remote: added 1 changesets with 1 changes to 1 files |
|
86 | remote: added 1 changesets with 1 changes to 1 files | |
85 | remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*: (glob) |
|
87 | remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*: (glob) | |
|
88 | remote: pushkey hook: HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_OLD=1 HG_RET=1 | |||
86 | % serve errors |
|
89 | % serve errors | |
87 | $ hg rollback |
|
90 | $ hg rollback | |
88 | repository tip rolled back to revision 0 (undo serve) |
|
91 | repository tip rolled back to revision 0 (undo serve) | |
@@ -99,10 +102,42 b' expect success, server lacks the unbundl' | |||||
99 | remote: adding file changes |
|
102 | remote: adding file changes | |
100 | remote: added 1 changesets with 1 changes to 1 files |
|
103 | remote: added 1 changesets with 1 changes to 1 files | |
101 | remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*: (glob) |
|
104 | remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*: (glob) | |
|
105 | remote: pushkey hook: HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_OLD=1 HG_RET=1 | |||
102 | % serve errors |
|
106 | % serve errors | |
103 | $ hg rollback |
|
107 | $ hg rollback | |
104 | repository tip rolled back to revision 0 (undo serve) |
|
108 | repository tip rolled back to revision 0 (undo serve) | |
105 |
|
109 | |||
|
110 | expect push success, phase change failure | |||
|
111 | ||||
|
112 | $ echo '[web]' > .hg/hgrc | |||
|
113 | $ echo 'push_ssl = false' >> .hg/hgrc | |||
|
114 | $ echo 'allow_push = *' >> .hg/hgrc | |||
|
115 | $ echo '[hooks]' >> .hg/hgrc | |||
|
116 | $ echo 'prepushkey = python "$TESTDIR/printenv.py" prepushkey 1' >> .hg/hgrc | |||
|
117 | $ req | |||
|
118 | pushing to http://localhost:$HGPORT/ | |||
|
119 | searching for changes | |||
|
120 | remote: adding changesets | |||
|
121 | remote: adding manifests | |||
|
122 | remote: adding file changes | |||
|
123 | remote: added 1 changesets with 1 changes to 1 files | |||
|
124 | remote: prepushkey hook: HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_OLD=1 | |||
|
125 | updating ba677d0156c1 to public failed! | |||
|
126 | % serve errors | |||
|
127 | ||||
|
128 | expect phase change success | |||
|
129 | ||||
|
130 | $ echo 'prepushkey = python "$TESTDIR/printenv.py" prepushkey 0' >> .hg/hgrc | |||
|
131 | $ req | |||
|
132 | pushing to http://localhost:$HGPORT/ | |||
|
133 | searching for changes | |||
|
134 | no changes found | |||
|
135 | remote: prepushkey hook: HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_OLD=1 | |||
|
136 | % serve errors | |||
|
137 | [1] | |||
|
138 | $ hg rollback | |||
|
139 | repository tip rolled back to revision 0 (undo serve) | |||
|
140 | ||||
106 | expect authorization error: all users denied |
|
141 | expect authorization error: all users denied | |
107 |
|
142 | |||
108 | $ echo '[web]' > .hg/hgrc |
|
143 | $ echo '[web]' > .hg/hgrc |
General Comments 0
You need to be logged in to leave comments.
Login now