path: copy revisions to clipboard now sorted

Matthias über TortoiseSVN-dev <[email protected]>
Newsgroups gmane.comp.version-control.subversion.tortoisesvn.devel
Message-ID <[email protected]>
The command "copy to clipboard / revisions" copied the revision numbers 
unsorted into clipboard.

I wrote a patch that sort the revision numbers before write them to 
clipboard.

-- 
You received this message because you are subscribed to the Google Groups "TortoiseSVN-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/tortoisesvn-dev/d8af35d5-857d-40e5-9715-c7330cf9f376n%40googlegroups.com.
patch_copyrevisionsToClipboardSorted.patch (text/plain, 1.6 KB)
Index: src/TortoiseProc/LogDialog/LogDlg.cpp
===================================================================
--- src/TortoiseProc/LogDialog/LogDlg.cpp	(revision 224)
+++ src/TortoiseProc/LogDialog/LogDlg.cpp	(working copy)
@@ -2040,9 +2040,9 @@
 void CLogDlg::CopyCommaSeparatedRevisionsToClipboard()
 {
     POSITION pos = m_LogList.GetFirstSelectedItemPosition();
-    CString  sRevisions;
-    CString  sRevision;
 
+    std::set<svn_revnum_t> setSelectedRevisions;
+
     if (pos != NULL)
     {
         while (pos)
@@ -2053,18 +2053,20 @@
             PLOGENTRYDATA pLogEntry = m_logEntries.GetVisible(index);
             if (pLogEntry)
             {
-                sRevision.Format(L"%ld, ", pLogEntry->GetRevision());
-                sRevisions += sRevision;
+                setSelectedRevisions.insert(pLogEntry->GetRevision());
             }
         }
-
-        // trim trailing comma and space
-        int revisionsLength = sRevisions.GetLength() - 2;
-        if (revisionsLength > 0)
-        {
-            sRevisions = sRevisions.Left(revisionsLength);
-            CStringUtils::WriteAsciiStringToClipboard(sRevisions, GetSafeHwnd());
+    }
+    if (setSelectedRevisions.size() > 0)
+    {
+        CString  sRevisions;
+        std::set<svn_revnum_t>::iterator it;
+        for (it = setSelectedRevisions.begin(); it != setSelectedRevisions.end(); ++it) {
+            if (!sRevisions.IsEmpty())
+                sRevisions += ", ";
+            sRevisions += SVNRev(*it).ToString();
         }
+        CStringUtils::WriteAsciiStringToClipboard(sRevisions, GetSafeHwnd());
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.