svn.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 22 Feb 2016 12:41:52 +0200
changeset 1903 901e7394849f
parent 1779 d57075ff7c32
child 1905 fba288d59662
permissions -rw-r--r--
Decrease intent to increase space usage on mobile.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1513
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
.. -*- coding: utf-8; -*-
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
.. include:: HEADER.rst
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
=============
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
 Subversion.
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
=============
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
.. contents::
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
Where palced config files?
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
==========================
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
The per-user configuration area currently contains three files two
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
configuration files ('config' and 'servers').
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
1777
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    15
  ``/etc/subversion``
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    16
    Unix system wide configurations.
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    17
  ``$HOME/.subversion``
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    18
    Unix per-user configuration area.
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    19
  ``%APPDATA%\Subversion``
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    20
    Windows per-user configuration area.
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    21
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    22
Coping repository.
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    23
==================
1513
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
1777
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    25
Making local repository copy::
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    26
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    27
  $ svnadmin create $SVNROOT
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    28
  $ svnsync init file://$SVNROOT svn://$REMOTE
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    29
  $ svnsync synchronize file://$SVNROOT
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    30
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    31
Note that you can't relocate working copy to new repository copy becase of::
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    32
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    33
  $ svn relocate file://$SVNROOT
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    34
  svn: E195009: The repository at 'file:///home/user/devel/repo-copy' has uuid 'b064fe9f-b7ba-459e-afdf-3429ad89a318', but the WC has '11827c6b-1af5-4614-8a8b-dda7fb34cd94'
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    35
d9b134f80a66 Coping repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
    36
Coping repository from SourceForge to GoogleCode::
1513
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
  $ svnsync init https://PROJ.googlecode.com/svn https://PROJ.svn.sourceforge.net/svnroot/PROJ
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
  $ svnsync --username NAME --password PASSWORD \
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
                sync https://PROJ.googlecode.com/svn https://PROJ.svn.sourceforge.net/svnroot/PROJ
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
Disable interactive conflict resolution.
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
========================================
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
Write in ``$HOME/.subversion/config``::
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
  [miscellany]
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
  interactive-conflicts = no
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
Creating svn repo.
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
==================
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
::
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
  $ mkdir -p /srv/svn
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
  $ svnadmin create /srv/svn/$repo
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
  $ svn co file:///srv/svn/$repo $repo
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
  $ cd /tmp/$repo
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
  $ mkdir trunk branches features tags
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
  $ svn add *
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
  $ svn st      # check all OK
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
  $ svn ci -m "Init repo."
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    62
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
For multi-project repo do follow::
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
  $ mkdir -p /srv/svn
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
  $ svnadmin create /srv/svn/$repo
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    67
  $ svn co file:///srv/svn/$repo $repo
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    68
  $ cd /tmp/$repo
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    69
  $ for proj in $proj1 $proj2; do mkdir $proj/trunk $proj/branches $proj/features $proj/tags; done
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    70
  $ svn add *
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    71
  $ svn st      # check all OK
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    72
  $ svn ci -m "Init repo."
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    73
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
Run local svn server.
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    75
=====================
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
::
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    77
1530
d41385c7d4cb Remove unnecessary .exe command suffix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1513
diff changeset
    78
  $ svnserve -d --pid-file=svnserve.pid --root=/srv/svn/proj  # default port: 3690
1513
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    79
  $ svn ls svn://localhost    # check all OK
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    80
  $ kill -l
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    81
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    82
Undo bad commit.
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    83
================
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    84
::
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    85
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    86
  $ emacs FILE
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    87
  ...
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    88
  $ svn ci -m "Introduce first bug."
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    89
  Sending        trunk/FILE
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    90
  Transmitting file data .
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    91
  Committed revision 7.
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    92
  $ emacs FILE
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    93
  ...
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    94
  $ svn ci -m "Make a lot of good changes."
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    95
  ...
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    96
  Committed revision 8.
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    97
  ...
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    98
  $ emacs FILE
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    99
  ...
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   100
  $ svn ci -m "Introduce second bug."
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   101
  ...
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   102
  Committed revision 10.
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   103
  $ emacs FILE
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   104
  ...
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   105
  $ svn ci -m "Make a lot of good changes."
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   106
  ...
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   107
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   108
Now you understand that revision 7 and 10 buggy. You decide revert changes::
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   109
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   110
  $ svn merge -r 7:6 -r 10:9 FILE
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   111
  $ svn ci -m "Reverted revision 7 and 10."
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   112
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   113
For one changeset revert you can use shortly syntax::
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   114
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   115
  $ svn merge -c -7 -c -10 FILE
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   116
1531
330085d06687 Fix typo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1530
diff changeset
   117
Also you can use ranges::
1513
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   118
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   119
  $ svn merge -r 10:6 FILE
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   120
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   121
Merge branches.
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   122
===============
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   123
::
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   124
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   125
  $ cd trunk
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   126
  $ svn mergeinfo --show-revs eligible ^/branches/feature
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   127
  $ svn merge ^/branches/feature
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   128
  $ svn ci -m 'Integrate feature X.'
2a6cd59d5863 Merge branches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   129
1778
2ea02b27659d Fix EOL style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1777
diff changeset
   130
Fix EOL style.
2ea02b27659d Fix EOL style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1777
diff changeset
   131
==============
2ea02b27659d Fix EOL style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1777
diff changeset
   132
::
2ea02b27659d Fix EOL style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1777
diff changeset
   133
2ea02b27659d Fix EOL style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1777
diff changeset
   134
  $ find . -type f -name '*.java' -exec svn propset svn:eol-style native {} ';'
2ea02b27659d Fix EOL style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1777
diff changeset
   135
  $ svn ci -m 'Fix svn:eol-style.'
2ea02b27659d Fix EOL style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1777
diff changeset
   136
1779
d57075ff7c32 Fix EOL style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1778
diff changeset
   137
Note that this actions pollute history. For example every line of file with
d57075ff7c32 Fix EOL style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1778
diff changeset
   138
CR/LF (created on Windows on file without ``svn:eol-style native``) after this
d57075ff7c32 Fix EOL style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1778
diff changeset
   139
actions would have new author in ``svn annotate``, and ``svn diff`` will show
d57075ff7c32 Fix EOL style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1778
diff changeset
   140
all on all change.
d57075ff7c32 Fix EOL style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1778
diff changeset
   141