Commits

Patrick Mézard committed 1d73e9e

clpush: fix traceback in copy handling code

  • Participants
  • Parent commits db3e314

Comments (0)

Files changed (2)

lib/codereview/codereview.py

 			status = 'A'
 			renamed = fctx.renamed()
 			if renamed:
-				pfctx = self.repo[renamed[1]][renamed[0]]
+				pfctx = self.repo.filectx(renamed[0], fileid=renamed[1])
 				before = pfctx.data()
 				status = 'M'
 			else:

tests/test-climport.t

+  $ echo "[ui]" >> $HGRCPATH
+  $ echo "interactive=true" >> $HGRCPATH
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "codereview=$(echo $(dirname $TESTDIR))/lib/codereview/codereview.py" >> $HGRCPATH
+  $ echo "rebase=" >> $HGRCPATH
+  $ cp "$TESTDIR/.codereview_upload_cookies_codereview.appspot.com" ~/
+
+Check for evolve extension
+
+  $ hg help amend >/dev/null 2>&1
+  $ status=$?
+  $ if [ $status -ne 0 ]; then
+  >     echo "activate evolve with --extra-config-opt"
+  >     exit 1
+  > fi
+
+Initialize repository
+
+  $ hg init repo
+  $ cd repo
+  $ cat > codereview.cfg <<EOF
+  > defaultcc: invalid@example.com
+  > EOF
+  $ cat >> $HGRCPATH <<EOF
+  > [paths]
+  > default=http://example.com/remote/url
+  > [codereview]
+  > allowediting = true
+  > EOF
+  $ echo a > a
+  $ touch b
+  $ echo c > c
+  $ hg commit -A -m init a b c
+  $ hg cp a aa
+  $ python -c "file('a', 'wb').write('a\r\na\r\n')"
+  $ hg mv b bb
+  $ python -c "file('bb', 'wb').write('\0binary')"
+  $ hg rm c
+  $ echo d > d
+  $ hg add d
+  $ hg commit -m change
+
+  $ hg clpush --traceback .
+  Issue created. URL: https://codereview.appspot.com/\d+ (re)
+  $ clid=$(hg log -r . --template '{clid}')
+  $ rev=$(hg log -r . --template '{node}')
+  $ hg up -C 0
+  3 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  $ echo z > z
+  $ hg ci -Am addz z
+  created new head
+  $ hg climport --dry-run ${clid}
+  Index: a
+  ===================================================================
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,2 @@
+  -a
+  +a
+  +a
+  Index: aa
+  ===================================================================
+  copy from a
+  copy to aa
+  Index: bb
+  ===================================================================
+  rename from b
+  rename to bb
+  index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..d33e3942cbbab79d0b3271f8f97e531afd6fff61
+  GIT binary patch
+  literal 7
+  Oc${NM%FIhFsssQCm;#0X
+  
+  Index: c
+  ===================================================================
+  deleted file mode 100644
+  --- a/c
+  +++ /dev/null
+  @@ -1,1 +0,0 @@
+  -c
+  Index: d
+  ===================================================================
+  new file mode 100644
+  --- /dev/null
+  +++ b/d
+  @@ -0,0 +1,1 @@
+  +d
+  $ hg clclose --delete ${rev}
+  Issue deleted. URL: https://codereview.appspot.com/\d+ (re)
+