tests/test-git-import
author Henrik Stuart <henrik.stuart@edlund.dk>
Sat, 23 May 2009 17:02:49 +0200
changeset 8562 e3495c399006
parent 5403 477136fa6571
child 10060 f780b1098efc
permissions -rwxr-xr-x
named branches: server branchmap wire protocol support (issue736) The repository command, 'branchmap', returns a dictionary, branchname -> [branchheads], and will be implemented for localrepo, httprepo and sshrepo. The following wire format is used for returning data: branchname1 branch1head2 branch1head2 ... branchname2 ... ... Branch names are URL encoded to escape white space, and branch heads are sent as hex encoded node ids. All branches and all their heads are sent. The background and motivation for this command is the desire for a richer named branch semantics when pushing changesets. The details are explained in the original proposal which is included below. 1. BACKGROUND The algorithm currently implemented in Mercurial only considers the graph theoretical heads when determining whether new heads are created, rather than using the branch heads as a count (the algorithm considers a branch head effectively closed when it is merged into another branch or a new named branch is started from that point onward). Our particular problem with the algorithm is that we'd like to see the following case working without forcing a push: Upsteam has: (0:dev) ---- (1:dev) \ `--- (2:stable) Someone merges stable into dev: (0:dev) ---- (1:dev) ------(3:dev) \ / `--- (2:stable) --------´ This can be pushed without --force (as it should). Now someone else does some coding on stable (a bug fix, say): (0:dev) ---- (1:dev) ------(3:dev) \ / `--- (2:stable) ---------´---------(4:stable) This time we need --force to push. We allow this to be pushed without using --force by getting all the remote branch heads (by extending the wire protocol with a new function). We would, furthermore, also prefer if it is impossible to push a new branch without --force (or a later --newbranch option so --force isn't shoe-horned into too many disparate functions, if need be), except of course in the case where the remote repository is empty. This is what our patches accomplish. 2. ALTERNATIVES We have, of course, considered some alternatives to reconstructing enough information to decide whether we are creating new remote branch heads, before we added the new wire protocol command. 2.1. LOOKUP ON REMOTE The main alternative is to use the information from remote.heads() and remote.lookup() to try to reconstruct enough graph information to decide whether we are creating new heads. This is not adequate as illustrated below. Remember that each lookup is typically a request-response pair over SSH or HTTP(S). If we have a simple repository at the remote end like this: (0:dev) ---- (1:dev) ---- (3:stable) \ `--- (2:dev) then remote.heads() will yield [2, 3]. Assume we have nodes [0, 1, 2] locally and want to create a new node, 4:dev, as a descendant from (1:dev), which should be OK as 1:dev is a branch head. If we do remote.lookup('dev') we will get [2]. Thus, we can get information about whether a branch exists on the remote server or not, but this does not solve our problem of figuring out whether we are creating new heads or not. Pushing 4:dev ought to be OK, since after the push, we still only have two heads on branch a. Using remote.lookup() and remote.heads() is thus not adequate to consistently decide whether we are creating new remote heads (e.g. in this situation the latter would never return 1:dev). 2.2. USING INCOMING TO RECONSTRUCT THE GRAPH An alternative would be to use information equivalent to hg incoming to get the full remote graph in addition to the local graph. To do this, we would have to get a changegroup(subset) bundle representing the remote end (which may be a substantial amount of data), getting the branch heads from an instantiated bundlerepository, deleting the bundle, and finally, we can compute the prepush logic. While this is backwards compatible, it will cause a possibly substantial slowdown of the push command as it first needs to pull in all changes. 3. FURTHER ARGUMENTS IN FAVOUR OF THE BRANCHMAP WIRE-PROTOCOL EXTENSION Currently, the commands incoming and pull, work based on the tip of a given branch if used with "-r branchname", making it hard to get all revisions of a certain branch only (if it has multiple heads). This can be solved by requesting the remote's branchheads and letting the revisions to be used with the command be these heads. This can be done by extending the commands with a new option, e.g.: hg pull -b branchname which will be turned into the equivalent of: hg pull -r branchhead1 -r branchhead2 -r branchhead3 We have a simple follow-up patch that can do this ready as well (although not submitted yet as it is pending the acceptance of the branch patch). 4. WRAP-UP We generally find that the branchmap wire protocol extension can provide better named branch support to Mercurial. Currently, some things, like the initial push scenario in this mail, are fairly counter-intuitive, and the more often you have to force push, the more it is likely you will get a lot of spurious and unnecessary merge nodes. Also, restricting incoming and pull to all changes on a branch rather than changes on the tip-most head would be a sensible extension to making named branches a first class citizen in Mercurial. Currently, named branches sometimes feel like a late-coming unwanted step-child. We have run it in a production environment for a while, with fewer multiple heads occurring in our repositories and fewer confused users as a result. Also, it fixes the long-standing issue 736. Co-contributor: Sune Foldager <cryo@cyanite.org>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2864
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     1
#!/bin/sh
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     2
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     3
hg init a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     4
cd a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     5
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     6
echo % new file
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     7
hg import -mnew - <<EOF
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     8
diff --git a/new b/new
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     9
new file mode 100644
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    10
index 0000000..7898192
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    11
--- /dev/null
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    12
+++ b/new
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    13
@@ -0,0 +1 @@
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    14
+a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    15
EOF
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    16
3589
1c9b6f1237e0 test for git empty new files
Brendan Cully <brendan@kublai.com>
parents: 2864
diff changeset
    17
echo % new empty file
1c9b6f1237e0 test for git empty new files
Brendan Cully <brendan@kublai.com>
parents: 2864
diff changeset
    18
hg import -mempty - <<EOF
1c9b6f1237e0 test for git empty new files
Brendan Cully <brendan@kublai.com>
parents: 2864
diff changeset
    19
diff --git a/empty b/empty
1c9b6f1237e0 test for git empty new files
Brendan Cully <brendan@kublai.com>
parents: 2864
diff changeset
    20
new file mode 100644
1c9b6f1237e0 test for git empty new files
Brendan Cully <brendan@kublai.com>
parents: 2864
diff changeset
    21
EOF
1c9b6f1237e0 test for git empty new files
Brendan Cully <brendan@kublai.com>
parents: 2864
diff changeset
    22
hg locate empty
1c9b6f1237e0 test for git empty new files
Brendan Cully <brendan@kublai.com>
parents: 2864
diff changeset
    23
2864
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    24
echo % chmod +x
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    25
hg import -msetx - <<EOF
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    26
diff --git a/new b/new
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    27
old mode 100644
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    28
new mode 100755
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    29
EOF
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    30
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    31
test -x new || echo failed
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    32
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    33
echo % copy
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    34
hg import -mcopy - <<EOF
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    35
diff --git a/new b/copy
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    36
old mode 100755
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    37
new mode 100644
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    38
similarity index 100%
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    39
copy from new
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    40
copy to copy
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    41
diff --git a/new b/copyx
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    42
similarity index 100%
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    43
copy from new
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    44
copy to copyx
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    45
EOF
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    46
5073
4cd52978e188 test-git-import: fake executable permissions.
Patrick Mezard <pmezard@gmail.com>
parents: 4679
diff changeset
    47
if "$TESTDIR/hghave" -q execbit; then
4cd52978e188 test-git-import: fake executable permissions.
Patrick Mezard <pmezard@gmail.com>
parents: 4679
diff changeset
    48
    test -f copy -a ! -x copy || echo failed
4cd52978e188 test-git-import: fake executable permissions.
Patrick Mezard <pmezard@gmail.com>
parents: 4679
diff changeset
    49
    test -x copyx || echo failed
4cd52978e188 test-git-import: fake executable permissions.
Patrick Mezard <pmezard@gmail.com>
parents: 4679
diff changeset
    50
else
4cd52978e188 test-git-import: fake executable permissions.
Patrick Mezard <pmezard@gmail.com>
parents: 4679
diff changeset
    51
    test -f copy || echo failed
4cd52978e188 test-git-import: fake executable permissions.
Patrick Mezard <pmezard@gmail.com>
parents: 4679
diff changeset
    52
fi
2864
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    53
cat copy
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    54
hg cat copy
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    55
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    56
echo % rename
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    57
hg import -mrename - <<EOF
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    58
diff --git a/copy b/rename
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    59
similarity index 100%
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    60
rename from copy
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    61
rename to rename
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    62
EOF
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    63
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    64
hg locate
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    65
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    66
echo % delete
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    67
hg import -mdelete - <<EOF
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    68
diff --git a/copyx b/copyx
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    69
deleted file mode 100755
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    70
index 7898192..0000000
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    71
--- a/copyx
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    72
+++ /dev/null
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    73
@@ -1 +0,0 @@
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    74
-a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    75
EOF
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    76
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    77
hg locate
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    78
test -f copyx && echo failed || true
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    79
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    80
echo % regular diff
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    81
hg import -mregular - <<EOF
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    82
diff --git a/rename b/rename
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    83
index 7898192..72e1fe3 100644
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    84
--- a/rename
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    85
+++ b/rename
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    86
@@ -1 +1,5 @@
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    87
 a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    88
+a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    89
+a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    90
+a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    91
+a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    92
EOF
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    93
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    94
echo % copy and modify
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    95
hg import -mcopymod - <<EOF
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    96
diff --git a/rename b/copy2
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    97
similarity index 80%
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    98
copy from rename
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    99
copy to copy2
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   100
index 72e1fe3..b53c148 100644
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   101
--- a/rename
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   102
+++ b/copy2
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   103
@@ -1,5 +1,5 @@
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   104
 a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   105
 a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   106
-a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   107
+b
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   108
 a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   109
 a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   110
EOF
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   111
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   112
hg cat copy2
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   113
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   114
echo % rename and modify
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   115
hg import -mrenamemod - <<EOF
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   116
diff --git a/copy2 b/rename2
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   117
similarity index 80%
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   118
rename from copy2
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   119
rename to rename2
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   120
index b53c148..8f81e29 100644
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   121
--- a/copy2
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   122
+++ b/rename2
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   123
@@ -1,5 +1,5 @@
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   124
 a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   125
 a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   126
 b
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   127
-a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   128
+c
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   129
 a
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   130
EOF
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   131
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   132
hg locate copy2
e2b69dbb2daa Tests for git import
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
   133
hg cat rename2
3701
05c8704a3743 handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3589
diff changeset
   134
05c8704a3743 handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3589
diff changeset
   135
echo % one file renamed multiple times
05c8704a3743 handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3589
diff changeset
   136
hg import -mmultirenames - <<EOF
05c8704a3743 handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3589
diff changeset
   137
diff --git a/rename2 b/rename3
05c8704a3743 handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3589
diff changeset
   138
rename from rename2
05c8704a3743 handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3589
diff changeset
   139
rename to rename3
05c8704a3743 handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3589
diff changeset
   140
diff --git a/rename2 b/rename3-2
05c8704a3743 handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3589
diff changeset
   141
rename from rename2
05c8704a3743 handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3589
diff changeset
   142
rename to rename3-2
05c8704a3743 handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3589
diff changeset
   143
EOF
05c8704a3743 handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3589
diff changeset
   144
hg log -vCr. --template '{rev} {files} / {file_copies%filecopy}\n'
05c8704a3743 handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3589
diff changeset
   145
05c8704a3743 handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3589
diff changeset
   146
hg locate rename2 rename3 rename3-2
05c8704a3743 handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3589
diff changeset
   147
hg cat rename3
05c8704a3743 handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3589
diff changeset
   148
echo
05c8704a3743 handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3589
diff changeset
   149
hg cat rename3-2
3716
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   150
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   151
echo foo > foo
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   152
hg add foo
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   153
hg ci -m 'add foo'
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   154
echo % binary files and regular patch hunks
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   155
hg import -m binaryregular - <<EOF
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   156
diff --git a/binary b/binary
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   157
new file mode 100644
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   158
index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   159
GIT binary patch
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   160
literal 4
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   161
Lc\${NkU|;|M00aO5
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   162
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   163
diff --git a/foo b/foo2
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   164
rename from foo
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   165
rename to foo2
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   166
EOF
ab5600428b08 handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3701
diff changeset
   167
cat foo2
3736
ad3d5b4367cb make manifest friendlier
Matt Mackall <mpm@selenic.com>
parents: 3717
diff changeset
   168
hg manifest --debug | grep binary
3717
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   169
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   170
echo % many binary files
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   171
hg import -m multibinary - <<EOF
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   172
diff --git a/mbinary1 b/mbinary1
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   173
new file mode 100644
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   174
index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   175
GIT binary patch
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   176
literal 4
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   177
Lc\${NkU|;|M00aO5
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   178
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   179
diff --git a/mbinary2 b/mbinary2
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   180
new file mode 100644
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   181
index 0000000000000000000000000000000000000000..112363ac1917b417ffbd7f376ca786a1e5fa7490
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   182
GIT binary patch
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   183
literal 5
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   184
Mc\${NkU|\`?^000jF3jhEB
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   185
9e248cfd8b94 handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3716
diff changeset
   186
EOF
3736
ad3d5b4367cb make manifest friendlier
Matt Mackall <mpm@selenic.com>
parents: 3717
diff changeset
   187
hg manifest --debug | grep mbinary
4679
826659bd8053 git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3736
diff changeset
   188
826659bd8053 git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3736
diff changeset
   189
echo % filenames with spaces
826659bd8053 git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3736
diff changeset
   190
hg import -m spaces - <<EOF
826659bd8053 git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3736
diff changeset
   191
diff --git a/foo bar b/foo bar
826659bd8053 git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3736
diff changeset
   192
new file mode 100644
826659bd8053 git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3736
diff changeset
   193
index 0000000..257cc56
826659bd8053 git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3736
diff changeset
   194
--- /dev/null
826659bd8053 git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3736
diff changeset
   195
+++ b/foo bar	
826659bd8053 git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3736
diff changeset
   196
@@ -0,0 +1 @@
826659bd8053 git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3736
diff changeset
   197
+foo
826659bd8053 git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3736
diff changeset
   198
EOF
826659bd8053 git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3736
diff changeset
   199
cat "foo bar"
826659bd8053 git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3736
diff changeset
   200
5403
477136fa6571 Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5073
diff changeset
   201
echo % copy then modify the original file
477136fa6571 Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5073
diff changeset
   202
hg import -m copy-mod-orig - <<EOF
477136fa6571 Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5073
diff changeset
   203
diff --git a/foo2 b/foo2
477136fa6571 Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5073
diff changeset
   204
index 257cc56..fe08ec6 100644
477136fa6571 Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5073
diff changeset
   205
--- a/foo2
477136fa6571 Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5073
diff changeset
   206
+++ b/foo2
477136fa6571 Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5073
diff changeset
   207
@@ -1 +1,2 @@
477136fa6571 Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5073
diff changeset
   208
 foo
477136fa6571 Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5073
diff changeset
   209
+new line
477136fa6571 Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5073
diff changeset
   210
diff --git a/foo2 b/foo3
477136fa6571 Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5073
diff changeset
   211
similarity index 100%
477136fa6571 Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5073
diff changeset
   212
copy from foo2
477136fa6571 Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5073
diff changeset
   213
copy to foo3
477136fa6571 Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5073
diff changeset
   214
EOF
477136fa6571 Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5073
diff changeset
   215
477136fa6571 Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5073
diff changeset
   216
cat foo3