tests/test-topic-debugcb.t
changeset 2899 32306ee32806
child 2900 1928e9c802dd
equal deleted inserted replaced
2898:3dfc88c06378 2899:32306ee32806
       
     1 Test for `hg debugconvertbookmark` added by topics
       
     2 ==================================================
       
     3 
       
     4   $ . "$TESTDIR/testlib/topic_setup.sh"
       
     5 
       
     6   $ cat << EOF >> $HGRCPATH
       
     7   > [ui]
       
     8   > logtemplate = [{rev}:{node|short}] {desc|firstline}\n\
       
     9   > {if(bookmarks, "  bookmark: {join(bookmarks,"\n  bookmark:")}\n")}\
       
    10   > {if(topics, "  topic: {topics}\n")}
       
    11   > EOF
       
    12 
       
    13   $ hg init repo
       
    14   $ cd repo
       
    15   $ echo "Hello" > a
       
    16   $ hg commit -Aqm "First commit"
       
    17   $ echo "Hello" > b
       
    18   $ hg commit -Aqm "Second commit"
       
    19   $ hg bookmark "hellos"
       
    20   $ hg up 0 -q
       
    21   $ echo "Fix 1" > l
       
    22   $ hg commit -Aqm "Fixing first"
       
    23   $ echo "Fix 2" > m
       
    24   $ hg commit -Aqm "Fixing second"
       
    25   $ hg bookmark "secondfix"
       
    26 
       
    27   $ hg log -G
       
    28   @  [3:b985e4fea4a4] Fixing second
       
    29   |    bookmark: secondfix
       
    30   o  [2:8e79b09248c2] Fixing first
       
    31   |
       
    32   | o  [1:50634233706a] Second commit
       
    33   |/     bookmark: hellos
       
    34   o  [0:3caf92e45cfb] First commit
       
    35   
       
    36 Help for the command
       
    37 ====================
       
    38 
       
    39   $ hg help debugconvertbookmark
       
    40   hg debugcb [-b BOOKMARK] [--all]
       
    41   
       
    42   aliases: debugconvertbookmark
       
    43   
       
    44   Converts a bookmark to a topic with the same name.
       
    45   
       
    46   options:
       
    47   
       
    48    -b --bookmark VALUE bookmark to convert to topic
       
    49       --all            convert all bookmarks to topics
       
    50   
       
    51   (some details hidden, use --verbose to show complete help)
       
    52 
       
    53 Running without any argument
       
    54 ============================
       
    55 
       
    56   $ hg debugconvertbookmark
       
    57   abort: you must specify either '--all' or '-b'
       
    58   [255]
       
    59 
       
    60 Changing a particular bookmark to topic
       
    61 =======================================
       
    62 
       
    63   $ hg debugconvertbookmark -b hellos
       
    64   changed topic to "hellos" on 1 revisions
       
    65   $ hg log -G
       
    66   o  [4:ca8825a7eb18] Second commit
       
    67   |    topic: hellos
       
    68   | @  [3:b985e4fea4a4] Fixing second
       
    69   | |    bookmark: secondfix
       
    70   | o  [2:8e79b09248c2] Fixing first
       
    71   |/
       
    72   o  [0:3caf92e45cfb] First commit
       
    73   
       
    74 Changing all bookmarks to topic
       
    75 ===============================
       
    76 
       
    77   $ hg debugconvertbookmark --all
       
    78   switching to topic secondfix
       
    79   changed topic to "secondfix" on 2 revisions
       
    80   $ hg log -G
       
    81   @  [6:6efc0524f97a] Fixing second
       
    82   |    topic: secondfix
       
    83   o  [5:0a4244c62a16] Fixing first
       
    84   |    topic: secondfix
       
    85   | o  [4:ca8825a7eb18] Second commit
       
    86   |/     topic: hellos
       
    87   o  [0:3caf92e45cfb] First commit
       
    88   
       
    89 Trying with multiple bookmarks on a single changeset
       
    90 ====================================================
       
    91 
       
    92   $ echo "multiple bookmarks" >> m
       
    93   $ hg commit -Aqm "Trying multiple bookmarks"
       
    94   $ hg bookmark book1
       
    95   $ hg bookmark book2
       
    96   $ hg log -G
       
    97   @  [7:7c46b4bbdda3] Trying multiple bookmarks
       
    98   |    bookmark: book1
       
    99   |    bookmark:book2
       
   100   |    topic: secondfix
       
   101   o  [6:6efc0524f97a] Fixing second
       
   102   |    topic: secondfix
       
   103   o  [5:0a4244c62a16] Fixing first
       
   104   |    topic: secondfix
       
   105   | o  [4:ca8825a7eb18] Second commit
       
   106   |/     topic: hellos
       
   107   o  [0:3caf92e45cfb] First commit
       
   108   
       
   109 XXX: When we have multiple bookmarks on the same changeset, we should skip that
       
   110 and do nothing. This should be fixed.
       
   111 
       
   112   $ hg debugconvertbookmark --all
       
   113   switching to topic book1
       
   114   changed topic to "book1" on 3 revisions
       
   115   changed topic to "book2" on 3 revisions
       
   116   $ hg log -G
       
   117   o  [13:f979f772bd7d] Trying multiple bookmarks
       
   118   |    topic: book2
       
   119   o  [12:2397fdab7b79] Fixing second
       
   120   |    topic: book2
       
   121   o  [11:0dd194861ea1] Fixing first
       
   122   |    topic: book2
       
   123   | @  [10:e738ed1df4b2] Trying multiple bookmarks
       
   124   | |    topic: book1
       
   125   | o  [9:4198fce21412] Fixing second
       
   126   | |    topic: book1
       
   127   | o  [8:221a9ddef504] Fixing first
       
   128   |/     topic: book1
       
   129   | o  [4:ca8825a7eb18] Second commit
       
   130   |/     topic: hellos
       
   131   o  [0:3caf92e45cfb] First commit
       
   132